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.

59 lines
3.0 KiB

<Window x:Class="MVVMSample.View.ViewMain"
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:MVVMSample.View" xmlns:model="clr-namespace:MVVMSample.Model"
mc:Ignorable="d"
Title="ViewMain" Height="200" Width="400">
<!--<Window.DataContext>
<model:ViewModelMain/>
</Window.DataContext>-->
<Grid>
<Grid.DataContext>
<model:ViewModelMain/>
</Grid.DataContext>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" VerticalAlignment="Center">Last Name</Label>
<Label Grid.Column="0" Grid.Row="1" VerticalAlignment="Center">First Name</Label>
<Label Grid.Column="0" Grid.Row="2" VerticalAlignment="Center">Birthday(Number)</Label>
<Label Grid.Column="0" Grid.Row="3" VerticalAlignment="Center">Full Name</Label>
<Label Grid.Column="0" Grid.Row="4" VerticalAlignment="Center">Birthday</Label>
<TextBox x:Name="txtLastName" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Margin="10,0,10,0"
Text="{Binding LastName, UpdateSourceTrigger=PropertyChanged}"/>
<TextBox x:Name="txtFirstName" Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" Margin="10,0,10,0"
Text="{Binding FirstName, UpdateSourceTrigger=PropertyChanged}"/>
<TextBox x:Name="txtBirthday" Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" Margin="10,0,10,0"
Text="{Binding Birthday, UpdateSourceTrigger=PropertyChanged}"/>
<Label x:Name="lblFullName" Grid.Column="1" Grid.Row="3" VerticalAlignment="Center" Margin="10,0,10,0"
Content="{Binding FullName, UpdateSourceTrigger=PropertyChanged}"/>
<Label x:Name="lblBirthday" Grid.Column="1" Grid.Row="4" VerticalAlignment="Center" Margin="10,0,10,0"
Content="{Binding BirthdayErrorMessage, UpdateSourceTrigger=PropertyChanged}">
<Label.Style>
<Style TargetType="{x:Type Label}">
<Setter Property="Foreground" Value="Black"/>
<Style.Triggers>
<DataTrigger Binding="{Binding BirthdayError}" Value="TRUE">
<Setter Property="Foreground" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
</Grid>
</Window>