|
|
|
@ -4,9 +4,23 @@ |
|
|
|
|
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="450" Width="800"> |
|
|
|
|
<Grid> |
|
|
|
|
Title="MainWindow" Height="100" Width="300"> |
|
|
|
|
<Window.Resources> |
|
|
|
|
<cvt:YesNoToBoolConverter x:Key="ynConvert"/> |
|
|
|
|
</Window.Resources> |
|
|
|
|
|
|
|
|
|
</Grid> |
|
|
|
|
<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> |
|
|
|
|