RoleDataConverter.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.ObjectModel;
  3. using System.Windows;
  4. using System.Windows.Data;
  5. using System.Windows.Media;
  6. namespace CyberX8_Themes.Converters
  7. {
  8. public class MenusToVisibility : IValueConverter
  9. {
  10. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  11. {
  12. if(value != null) return Visibility.Collapsed;
  13. return Visibility.Visible;
  14. }
  15. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  16. {
  17. return null;
  18. }
  19. }
  20. public class MenusToCount : IValueConverter
  21. {
  22. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  23. {
  24. if (value != null) {
  25. //ObservableCollection<Menu> items = value as ObservableCollection<Menu>;
  26. return "";
  27. }
  28. return "";
  29. }
  30. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  31. {
  32. return null;
  33. }
  34. }
  35. public class MenusToColor : IValueConverter
  36. {
  37. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  38. {
  39. if (value != null)
  40. {
  41. return new SolidColorBrush(Colors.Blue);
  42. }
  43. return new SolidColorBrush(Colors.Black);
  44. }
  45. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  46. {
  47. return null;
  48. }
  49. }
  50. }