public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is LockUnlockState)) { throw new ArgumentException("invalid value"); } LockUnlockState stateValue = (LockUnlockState)value; return(Enum.GetName(typeof(LockUnlockState), stateValue)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is LockUnlockState)) { throw new ArgumentException("invalid value"); } LockUnlockState stateValue = (LockUnlockState)value; if (stateValue == LockUnlockState.LOCK) { return(new SolidColorBrush(Colors.Red)); } else { return(new SolidColorBrush(Colors.Green)); } }