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 ca开发者_如何学Cn 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>
精彩评论