Simple data bind
This commit is contained in:
@@ -5,19 +5,29 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:SimpleDataBinding"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="180" Width="300">
|
||||
<Window.DataContext>
|
||||
<local:Cities/>
|
||||
</Window.DataContext>
|
||||
Title="MainWindow" Height="400" Width="300">
|
||||
|
||||
<StackPanel Orientation="Vertical" Margin="20">
|
||||
<Label HorizontalAlignment="Center" FontSize="20" FontWeight="Bold" Margin="0 0 0 20"
|
||||
Content="Which city do you love?"/>
|
||||
<CheckBox Content="SEOUL" IsChecked="{Binding Seoul}"/>
|
||||
<CheckBox Content="JEJOO" IsChecked="{Binding Jejoo}"/>
|
||||
<CheckBox Content="INCHEON" IsChecked="{Binding Incheon}"/>
|
||||
<Button VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
<StackPanel>
|
||||
<StackPanel.DataContext>
|
||||
<local:Cities/>
|
||||
</StackPanel.DataContext>
|
||||
|
||||
<TextBlock HorizontalAlignment="Center" FontSize="20" FontWeight="Bold" Margin="0 0 0 20"
|
||||
Text="Which city do you love?"/>
|
||||
<CheckBox Content="SEOUL" IsChecked="{Binding Seoul}"/>
|
||||
<CheckBox Content="JEJOO" IsChecked="{Binding Jejoo}"/>
|
||||
<CheckBox Content="INCHEON" IsChecked="{Binding Incheon}"/>
|
||||
<Button VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
Content="Submit"
|
||||
Click="Button_Click"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock HorizontalAlignment="Center" FontSize="15" FontWeight="Bold" Margin="0 0 0 20"
|
||||
Text="Bellow is one way binding sample"/>
|
||||
<TextBox x:Name="tb1" Text="{Binding Mode=OneWay}"/>
|
||||
<TextBox x:Name="tb2" Text="{Binding ElementName=tb1, Path=Text}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
|
Reference in New Issue
Block a user