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 fix blurry images in Google Chrome

Problem When browsing sites with thumbnail images, those images appear blurred in Chrome, but not in other browsers such as Internet Explore...