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.
46 lines
2.0 KiB
46 lines
2.0 KiB
<Window x:Class="BindingSample.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:BindingSample"
|
|
xmlns:model="clr-namespace:BindingSample.Model"
|
|
mc:Ignorable="d"
|
|
Title="MainWindow" Height="500" Width="500">
|
|
|
|
<Window.Resources>
|
|
<model:Customers x:Key="rscCustomer">
|
|
<model:Customer Name="Richard" Tel="010-0000-0000"/>
|
|
<model:Customer Name="Jackson" Tel="010-1111-1111"/>
|
|
<model:Customer Name="Tylor" Tel="010-2222-2222"/>
|
|
<model:Customer Name="Sydney" Tel="010-3333-3333"/>
|
|
</model:Customers>
|
|
<Style x:Key="styTextBlock" TargetType="TextBlock">
|
|
<Setter Property="FontSize" Value="16"/>
|
|
<Setter Property="FontWeight" Value="Bold"/>
|
|
</Style>
|
|
</Window.Resources>
|
|
|
|
<Grid x:Name="rgdMain" Margin="10" DataContext="{StaticResource rscCustomer}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition/>
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<Label Grid.Column="0" Grid.Row="0" Content="Name: " Margin="10"/>
|
|
<TextBox Grid.Column="1" Grid.Row="0" Margin="10"
|
|
Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
|
<Label Grid.Column="2" Grid.Row="0" Content="Tel: " Margin="10"/>
|
|
<TextBox Grid.Column="3" Grid.Row="0" Margin="10"
|
|
Text="{Binding Tel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
|
</Grid>
|
|
|
|
|
|
</Window>
|
|
|