<Window x:Class="XLAB2.TpvdklWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Виды клейм"
        Height="420"
        Width="720"
        MinHeight="380"
        MinWidth="660"
        Loaded="Window_Loaded"
        WindowStartupLocation="CenterOwner">
    <Grid Margin="12">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0"
                   Margin="0,0,0,8"
                   FontWeight="SemiBold"
                   Text="{Binding Caption}" />

        <DataGrid Grid.Row="1"
                  ItemsSource="{Binding Items}"
                  SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                  AutoGenerateColumns="False"
                  CanUserAddRows="False"
                  IsReadOnly="True"
                  HeadersVisibility="Column">
            <DataGrid.ContextMenu>
                <ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
                    <MenuItem Header="Добавить"
                              Command="{Binding AddCommand}" />
                    <MenuItem Header="Изменить"
                              Command="{Binding EditCommand}" />
                    <MenuItem Header="Удалить"
                              Command="{Binding DeleteCommand}" />
                </ContextMenu>
            </DataGrid.ContextMenu>
            <DataGrid.RowStyle>
                <Style TargetType="DataGridRow">
                    <EventSetter Event="PreviewMouseRightButtonDown"
                                 Handler="DataGridRow_PreviewMouseRightButtonDown" />
                </Style>
            </DataGrid.RowStyle>
            <DataGrid.Columns>
                <DataGridTextColumn Header="ID"
                                    Width="70"
                                    Binding="{Binding Id}" />
                <DataGridTextColumn Header="Вид МК"
                                    Width="220"
                                    Binding="{Binding VerificationTypeName}" />
                <DataGridTextColumn Header="Вид клейма"
                                    Width="*"
                                    Binding="{Binding StampKindName}" />
            </DataGrid.Columns>
        </DataGrid>

        <StackPanel Grid.Row="2"
                    Margin="0,12,0,0"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right">
            <Button Width="90"
                    IsCancel="True"
                    Content="Закрыть" />
        </StackPanel>
    </Grid>
</Window>
