BoolBrushConverter.cs 989 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Net;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. using System.Windows.Documents;
  6. using System.Windows.Ink;
  7. using System.Windows.Input;
  8. using System.Windows.Media;
  9. using System.Windows.Media.Animation;
  10. using System.Windows.Shapes;
  11. using System.Windows.Data;
  12. namespace WindowsPhone.Recipes.Push.Client.Converters
  13. {
  14. public class BoolBrushConverter : IValueConverter
  15. {
  16. private static readonly Brush DisabledBrush = new SolidColorBrush
  17. {
  18. Color = Colors.Black,
  19. Opacity = 0.4
  20. };
  21. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  22. {
  23. return object.Equals(value, true) ? null : DisabledBrush;
  24. }
  25. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  26. {
  27. throw new NotSupportedException();
  28. }
  29. }
  30. }