Files
QuickMVVM/QuickMVVMSetup/MainWindow.xaml
2022-08-08 08:01:47 +02:00

70 lines
3.0 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>
<Button Content="Add" Height="30" Width="120" Margin="5, 20" HorizontalAlignment="Right" Command="{Binding CMDAdd}"/>
</StackPanel>
<ListView Grid.Row="1" Background="#FFDBEFCA" ItemsSource="{Binding Persons}">
<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>