You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
1.2 KiB

<Window x:Class="ValueConverterSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ValueConverterSample"
xmlns:cvt="clr-namespace:ValueConverterSample.Converter"
mc:Ignorable="d"
Title="MainWindow" Height="100" Width="300">
<Window.Resources>
<cvt:YesNoToBoolConverter x:Key="ynConvert"/>
</Window.Resources>
<StackPanel>
<TextBox x:Name="tbMain"
Text="YES"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Current value: "/>
<TextBlock x:Name="tbCheck"
Text="{Binding ElementName=tbMain, Path=Text, Converter={StaticResource ynConvert}}"/>
</StackPanel>
<CheckBox Content="{Binding ElementName=tbMain, Path=Text}"
IsChecked="{Binding ElementName=tbMain, Path=Text, Converter={StaticResource ynConvert}}"/>
</StackPanel>
</Window>