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 find the last interactive logons in Windows using PowerShell

Use the following powershell script to find the last users to login to a box since a given date, in this case the 21st April 2022 at 12pm un...