1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 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_Master.DataConvert
- {
- /// <summary>
- /// Color to SolidColorBrush
- /// </summary>
- 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;
- }
- }
- public class SizeBrushConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return Brushes.Black;
- }
- else
- {
- if ((int)value>150)
- {
- return Brushes.Red;
- }
- else
- {
- return Brushes.Black;
- }
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if ((SolidColorBrush)value != null)
- {
- return ((SolidColorBrush)value).Color;
- }
- return Brushes.White.Color;
- }
- }
- }
|