I want to databind a textblock to some CLR objects so I can display details about a users system.
Example:
TextBlock Grid.Column="1" Text="{Binding Path=System.Environment.OSVersion}"
How can I pull this type of thing off?
I want to databind a textblock to some CLR objects so I can display details about a users system.
Example:
TextBlock Grid.Column="1" Text="{Binding Path=System.Environment.OSVersion}"
How can I pull this type of thing off?
Your only problem is that System.Environment.OSVersion
is static
.
This should work:
<UserControl
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
...
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<TextBlock Text="{Binding Source={x:Static sys:Environment.OSVersion}}">
</UserControl>