Binding Environment Info
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:src="clr-namespace:WpfApplication1.EnvironmentInfo2"
Title="Environment Info">
<Window.Resources>
<src:FormattedMultiTextConverter x:Key="conv" />
</Window.Resources>
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource conv}"
ConverterParameter=
"Operating System Version: {0}

.NET Version: {1}

Machine Name: {2}

User Name: {3}" >
<Binding Source="{x:Static s:Environment.OSVersion}" />
<Binding Source="{x:Static s:Environment.Version}" />
<Binding Source="{x:Static s:Environment.MachineName}" />
<Binding Source="{x:Static s:Environment.UserName}" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Window>
//File:Window.xaml.vb
Imports System
Imports System.Globalization
Imports System.Windows
Imports System.Windows.Data
Namespace WpfApplication1.EnvironmentInfo2
Public Class FormattedMultiTextConverter
Implements IMultiValueConverter
Public Function Convert(value As Object(), typeTarget As Type, param As Object, culture As CultureInfo) As Object Implements IMultiValueConverter.Convert
Return [String].Format(DirectCast(param, String), value)
End Function
Public Function ConvertBack(value As Object, typeTarget As Type(), param As Object, culture As CultureInfo) As Object() Implements IMultiValueConverter.ConvertBack
Return Nothing
End Function
End Class
End Namespace
Related examples in the same category