Stylet/Samples/Stylet.Samples.MasterDetail/ShellView.xaml

38 lines
1.8 KiB
XML

<Window x:Class="Stylet.Samples.MasterDetail.ShellView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="https://github.com/canton7/Stylet"
Title="ShellView" Height="200" Width="400">
<DockPanel>
<DockPanel DockPanel.Dock="Left">
<Button DockPanel.Dock="Bottom" Command="{s:Action AddEmployee}">Hire Employee</Button>
<ListBox DockPanel.Dock="Top" Width="200" ItemsSource="{Binding Employees}" SelectedItem="{Binding SelectedEmployee}" HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
<DockPanel LastChildFill="False">
<TextBlock DockPanel.Dock="Left">Name: </TextBlock>
<TextBlock DockPanel.Dock="Left" Text="{Binding Name}"/>
<Button DockPanel.Dock="Right" Command="{s:Action RemoveEmployee}" CommandParameter="{Binding}">Fire</Button>
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
<Grid DockPanel.Dock="Right" DataContext="{Binding SelectedEmployee}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0">Name:</Label>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Name}"/>
</Grid>
</DockPanel>
</Window>