1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#region EnabledConverter
//--------------------------------------------------------------------------
public class EnabledConverter : IMultiValueConverter
{
//--------------------------------------------------------------------------
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
try
{
bool eq = (bool)(values[0]);
bool sup = (bool)(values[1]);
if (parameter as string == "MENU")
return !(eq || sup);
else
return (eq & !sup);
}
catch { }
return true;
}
//--------------------------------------------------------------------------
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException("Not supported");
}
//--------------------------------------------------------------------------
} |
Partager