ColorToBrushConverter.cs 906 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Data;
  6. using DataAnalysisControl.Core;
  7. namespace Aitex.UI.Charting.Converter
  8. {
  9. public class ColorToBrushConverter : IValueConverter
  10. {
  11. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  12. {
  13. try
  14. {
  15. var color = (System.Windows.Media.Color)value;
  16. return new System.Windows.Media.SolidColorBrush(color);
  17. }
  18. catch (Exception ex)
  19. {
  20. CONTEXT.WriteLog(ex);
  21. }
  22. return System.Windows.Media.Brushes.Black;
  23. }
  24. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  25. {
  26. return null;
  27. }
  28. }
  29. }