75 lines
3.4 KiB
XML
75 lines
3.4 KiB
XML
<Window x:Class="QuickMVVMSetup.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:QuickMVVMSetup"
|
|
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
|
|
Title="MainWindow" Height="450" Width="400">
|
|
<Window.Resources>
|
|
<ResourceDictionary>
|
|
<Style TargetType="{x:Type ItemsControl}">
|
|
<Setter Property="Margin" Value="5"/>
|
|
<Setter Property="ItemsPanel">
|
|
<Setter.Value>
|
|
<ItemsPanelTemplate>
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition />
|
|
<ColumnDefinition />
|
|
</Grid.ColumnDefinitions>
|
|
</Grid>
|
|
</ItemsPanelTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</ResourceDictionary>
|
|
</Window.Resources>
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition/>
|
|
<RowDefinition/>
|
|
</Grid.RowDefinitions>
|
|
<StackPanel Margin="10">
|
|
<ItemsControl>
|
|
<TextBlock Text="First Name" />
|
|
<TextBox Grid.Column="1" Text="{Binding TargetPerson.FName}"/>
|
|
</ItemsControl>
|
|
<ItemsControl>
|
|
<TextBlock Text="Last Name" />
|
|
<TextBox Grid.Column="1" Text="{Binding TargetPerson.LName}"/>
|
|
</ItemsControl>
|
|
<ItemsControl>
|
|
<TextBlock Text="Age" />
|
|
<TextBox Grid.Column="1" Text="{Binding TargetPerson.Age}"/>
|
|
</ItemsControl>
|
|
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right" Margin="5,20">
|
|
<Button Content="Add" Height="30" Width="120" Margin="5" HorizontalAlignment="Right" Command="{Binding CMDAdd}"/>
|
|
<Button Content="Delete" Height="30" Width="120" Margin="5" HorizontalAlignment="Right"
|
|
CommandParameter="{Binding ElementName=lstView,Path=SelectedItem}" Command="{Binding CMDDelete}"/>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
<ListView x:Name="lstView" Grid.Row="1" Background="#FFDBEFCA" ItemsSource="{Binding Persons}"
|
|
SelectionMode="Single">
|
|
<ListView.ItemTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="{Binding FName}" />
|
|
<TextBlock Text=" - " Foreground="Blue" />
|
|
<TextBlock Text="{Binding LName}" />
|
|
<TextBlock Text=" - " Foreground="Blue" />
|
|
<TextBlock Text="{Binding Age}" />
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListView.ItemTemplate>
|
|
<!--<WrapPanel>
|
|
<TextBlock Text="First Name" />
|
|
<TextBlock Text=" - " Foreground="Blue" />
|
|
<TextBlock Text="Last Name" />
|
|
<TextBlock Text=" - " Foreground="Blue" />
|
|
<TextBlock Text="Age" />
|
|
</WrapPanel>-->
|
|
</ListView>
|
|
</Grid>
|
|
</Window>
|