using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; using System.Windows.Media; namespace PDF_Office.DataConvert { /// /// Color to SolidColorBrush /// public class ColorBrushConvert : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if((Color)value!=null) { return new SolidColorBrush((Color)value); } return Brushes.White; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if((SolidColorBrush)value!=null) { return ((SolidColorBrush)value).Color; } return Brushes.White.Color; } } }