123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 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
- {
- class IntToColorBrush : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- SolidColorBrush brush = new SolidColorBrush(Colors.Black);
- switch ((int)value)
- {
- case 1:
- brush = new SolidColorBrush(Colors.Black);
- break;
- case 2:
- brush = new SolidColorBrush(Colors.Red);
- break;
- case 3:
- brush = new SolidColorBrush(Colors.Green);
- break;
- case 4:
- brush = new SolidColorBrush(Colors.Blue);
- break;
- default:
- break;
- }
- return brush;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|