views:

409

answers:

1
<Button IsEnabled="{Binding (Not IsDisabled)}" />

Is there a way to do it with pure xaml, or I will have to do it via code? PS. I asked the question knowing that I can create a boolean converter like this:

<ValueConversion(GetType(Boolean), GetType(Boolean))> 
Public Class BooleanFlagSwitchConverter : Implements IValueConverter

    Public Function Convert(value As Object, targetType As Type, 
            parameter As Object, culture As CultureInfo) As Object 
            Implements IValueConverter.Convert
        Return Not value
    End Function

    Public Function ConvertBack(value As Object, targetType As Type, 
            parameter As Object, ByVal culture As CultureInfo) As Object 
            Implements IValueConverter.ConvertBack
        Return Not value
    End Function

End Class

[ValueConversion(typeof(bool), typeof(bool))]
public class BooleanFlagSwitchConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, 
        CultureInfo culture)
    {
        return !(bool)value;
    }

    public object ConvertBack(object value, Type targetType, object parameter, 
        CultureInfo culture)
    {
        return !(bool)value;
    }
}
+3  A: 

It doesn't exist. Look at the properties on the Binding class. There's nothing, other than a converter that will do what you want.

Scott Weinstein