<Window x:Class="XLAB2.VerificationEditWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{Binding Title}"
        Height="360"
        Width="520"
        MinHeight="320"
        MinWidth="480"
        WindowStartupLocation="CenterOwner"
        ResizeMode="NoResize">
    <Grid Margin="16">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="170" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <TextBlock Grid.Row="0"
                   Grid.Column="0"
                   Margin="0,0,12,8"
                   VerticalAlignment="Center"
                   Text="Дата поверки" />
        <DatePicker Grid.Row="0"
                    Grid.Column="1"
                    Margin="0,0,0,8"
                    SelectedDate="{Binding VerificationDate, Mode=TwoWay}"
                    SelectedDateFormat="Short" />

        <TextBlock Grid.Row="1"
                   Grid.Column="0"
                   Margin="0,0,12,8"
                   VerticalAlignment="Center"
                   Text="Поверитель" />
        <ComboBox Grid.Row="1"
                  Grid.Column="1"
                  Margin="0,0,0,8"
                  ItemsSource="{Binding Verifiers}"
                  DisplayMemberPath="FullName"
                  SelectedValuePath="PersonId"
                  SelectedValue="{Binding SelectedVerifierId, Mode=TwoWay}" />

        <TextBlock Grid.Row="2"
                   Grid.Column="0"
                   Margin="0,0,12,8"
                   VerticalAlignment="Center"
                   Text="{Binding DocumentFormCaption}" />
        <ComboBox Grid.Row="2"
                  Grid.Column="1"
                  Margin="0,0,0,8"
                  ItemsSource="{Binding DocumentForms}"
                  DisplayMemberPath="DocumentFormName"
                  SelectedItem="{Binding SelectedDocumentForm, Mode=TwoWay}" />

        <TextBlock Grid.Row="3"
                   Grid.Column="0"
                   Margin="0,0,12,8"
                   VerticalAlignment="Center"
                   Text="{Binding DocumentNumberCaption}" />
        <TextBox Grid.Row="3"
                 Grid.Column="1"
                 Margin="0,0,0,8"
                 Text="{Binding VerificationDocumentNumber, UpdateSourceTrigger=PropertyChanged}" />

        <TextBlock Grid.Row="4"
                   Grid.Column="0"
                   Margin="0,0,12,8"
                   VerticalAlignment="Center"
                   Visibility="{Binding StickerVisibility}"
                   Text="Номер наклейки" />
        <TextBox Grid.Row="4"
                 Grid.Column="1"
                 Margin="0,0,0,8"
                 Visibility="{Binding StickerVisibility}"
                 Text="{Binding StickerNumber, UpdateSourceTrigger=PropertyChanged}" />

        <TextBlock Grid.Row="5"
                   Grid.Column="0"
                   Margin="0,0,12,8"
                   VerticalAlignment="Top"
                   Visibility="{Binding RejectionReasonVisibility}"
                   Text="Причина непригодности" />
        <TextBox Grid.Row="5"
                 Grid.Column="1"
                 Margin="0,0,0,8"
                 MinHeight="72"
                 AcceptsReturn="True"
                 TextWrapping="Wrap"
                 VerticalScrollBarVisibility="Auto"
                 Visibility="{Binding RejectionReasonVisibility}"
                 Text="{Binding RejectionReason, UpdateSourceTrigger=PropertyChanged}" />

        <TextBlock Grid.Row="6"
                   Grid.ColumnSpan="2"
                   Margin="0,8,0,0"
                   Foreground="Firebrick"
                   Text="{Binding ValidationMessage}" />

        <StackPanel Grid.Row="7"
                    Grid.ColumnSpan="2"
                    Margin="0,12,0,0"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right">
            <Button Width="100"
                    Margin="0,0,8,0"
                    IsDefault="True"
                    Command="{Binding ConfirmCommand}"
                    Content="Сохранить" />
            <Button Width="90"
                    Command="{Binding CancelCommand}"
                    Content="Отмена" />
        </StackPanel>
    </Grid>
</Window>
