| 1234567891011121314151617181920212223242526272829303132333435363738 |
- using System;
- using System.Globalization;
- using System.Windows.Data;
- using System.Windows.Media;
- namespace SWRIS.Converters
- {
- public class MenuNameToColorConverter : IValueConverter
- {
- private static readonly SolidColorBrush activeBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFFFFF"));
- private static readonly SolidColorBrush unActiveBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#AEBAE8"));
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- var menuName = (string)value;
- switch (menuName)
- {
- case "Home":
- if (parameter != null && parameter.ToString() == "Home")
- {
- return activeBrush;
- }
- return unActiveBrush;
- case "Record":
- if (parameter != null && parameter.ToString() == "Record")
- {
- return activeBrush;
- }
- return unActiveBrush;
- }
- return 0;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|