using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Data; using System.Globalization; using System.Windows.Media; namespace SudokuWeek4.Models.Converters { internal class BackgroundValueConverter : IValueConverter { private static readonly BackgroundValueConverter _instance = new BackgroundValueConverter(); public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is Boolean && targetType == typeof(Brush)) { Boolean color = (Boolean)value; if (color) return Brushes.Red; else return Brushes.Transparent; } // The type is not a brush return null; } // Create a property to get the instance of the BackgroundValue public static BackgroundValueConverter Instance { get { return _instance; } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }