Friday, 2 May 2014

WPF binding to static property

Just so I don't forget again, here's how it's done...

xmlns:ValueConverters="clr-namespace:ValueConverters;assembly=Controls"
xmlns:Services="clr-namespace:Infrastructure.Interface.Services;assembly=Infrastructure.Interface"

...

        <ValueConverters:BooleanToVisibilityConverter2 x:Key="booleanToVisibilityConverter2" />
    </ResourceDictionary>

</UserControl.Resources>

...

<StackPanel x:Name="MyStackPanel"
            Orientation="Vertical"
            Visibility="{Binding Source={x:Static Services:UserPreferencesService.Instance}, Path=UseWebAssignment, Converter={StaticResource booleanToVisibilityConverter2}, ConverterParameter=true}">

No comments:

Post a Comment

How to by pass the Jaguary X-Type enter security pin screen after changing battery

How to bypass security code on Jaguar X-Type touchscreen Satellite Navigational units. Just hold the skip track, AMEM and PTY buttons ...