|
|
|
|
<Window x:Class="AddressBook_MVVMSample.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:AddressBook_MVVMSample"
|
|
|
|
|
mc:Ignorable="d"
|
|
|
|
|
d:DataContext="{d:DesignInstance local:MainWindow}"
|
|
|
|
|
Title="MainWindow" Height="328" Width="525"
|
|
|
|
|
WindowStartupLocation="CenterScreen">
|
|
|
|
|
<!--<Window.DataContext>
|
|
|
|
|
<local:MainWindow/>
|
|
|
|
|
</Window.DataContext>-->
|
|
|
|
|
|
|
|
|
|
<Grid>
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<RowDefinition Height="*"/>
|
|
|
|
|
<RowDefinition Height="50"/>
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
<DataGrid Grid.Row="0" Width="500" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10"
|
|
|
|
|
SelectedIndex="{Binding SelectedIndex, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
|
|
|
|
|
ItemsSource="{Binding Persons, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
|
|
|
|
|
AutoGenerateColumns="False"
|
|
|
|
|
IsReadOnly="True">
|
|
|
|
|
<DataGrid.Columns>
|
|
|
|
|
<DataGridTextColumn Header="Name" Width="100"
|
|
|
|
|
Binding="{Binding Name}"/>
|
|
|
|
|
<DataGridTextColumn Header="Gender" Width="Auto"
|
|
|
|
|
Binding="{Binding Gender}"/>
|
|
|
|
|
<DataGridTextColumn Header="Phone" Width="150"
|
|
|
|
|
Binding="{Binding PhoneNumber}"/>
|
|
|
|
|
<DataGridTextColumn Header="Address" Width="*"
|
|
|
|
|
Binding="{Binding Address}"/>
|
|
|
|
|
</DataGrid.Columns>
|
|
|
|
|
</DataGrid>
|
|
|
|
|
|
|
|
|
|
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
|
|
|
|
<Button Width="80" VerticalAlignment="Center" Margin="5" IsEnabled="True"
|
|
|
|
|
Content="Add"
|
|
|
|
|
Command="{Binding AddCommand}"/>
|
|
|
|
|
<Button Width="80" VerticalAlignment="Center" Margin="5"
|
|
|
|
|
Content="Modify"
|
|
|
|
|
Command="{Binding ModiftyCommand}"/>
|
|
|
|
|
<Button Width="80" VerticalAlignment="Center" Margin="5"
|
|
|
|
|
Content="Delete"
|
|
|
|
|
Command="{Binding DeleteCommand}"/>
|
|
|
|
|
<Button Width="80" VerticalAlignment="Center" Margin="5"
|
|
|
|
|
Content="Exit"
|
|
|
|
|
Command="{Binding ExitCommand}"/>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Window>
|