<Window x:Class="XLAB.TprmkEditWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{Binding Title}"
        Height="620"
        Width="760"
        MinHeight="580"
        MinWidth="700"
        WindowStartupLocation="CenterOwner">
    <Grid Margin="16">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="220" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Вид МК" />
            <ComboBox Grid.Row="0" Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding VerificationTypes}" SelectedValue="{Binding VerificationTypeId}" SelectedValuePath="Id" DisplayMemberPath="Name" IsTextSearchEnabled="True" />

            <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 Organizations}" SelectedValue="{Binding OrganizationId}" SelectedValuePath="Id" DisplayMemberPath="Name" IsTextSearchEnabled="True" />

            <TextBlock Grid.Row="2" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Квалификация" />
            <ComboBox Grid.Row="2" Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding Qualifications}" SelectedValue="{Binding QualificationId}" SelectedValuePath="Id" DisplayMemberPath="Name" IsTextSearchEnabled="True" />

            <TextBlock Grid.Row="3" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Группа СИ" />
            <ComboBox Grid.Row="3" Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding Groups}" SelectedValue="{Binding GroupId}" SelectedValuePath="Id" DisplayMemberPath="Name" IsTextSearchEnabled="True" />

            <TextBlock Grid.Row="4" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Место МК" />
            <ComboBox Grid.Row="4" Grid.Column="1" Margin="0,0,0,8" ItemsSource="{Binding Places}" SelectedValue="{Binding PlaceId}" SelectedValuePath="Id" DisplayMemberPath="Name" IsTextSearchEnabled="True" />

            <TextBlock Grid.Row="5" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Стоимость / доп. / срочность" />
            <StackPanel Grid.Row="5" Grid.Column="1" Orientation="Horizontal">
                <TextBox Width="110" Margin="0,0,8,8" Text="{Binding CostText, UpdateSourceTrigger=PropertyChanged}" />
                <TextBox Width="110" Margin="0,0,8,8" Text="{Binding ExtraCostText, UpdateSourceTrigger=PropertyChanged}" />
                <TextBox Width="110" Margin="0,0,0,8" Text="{Binding RushMarkupText, UpdateSourceTrigger=PropertyChanged}" />
            </StackPanel>

            <TextBlock Grid.Row="6" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Норма времени / НД" />
            <StackPanel Grid.Row="6" Grid.Column="1" Orientation="Horizontal">
                <TextBox Width="110" Margin="0,0,8,8" Text="{Binding TimeNormHoursText, UpdateSourceTrigger=PropertyChanged}" />
                <TextBox Width="110" Margin="0,0,0,8" Text="{Binding NormDocHoursText, UpdateSourceTrigger=PropertyChanged}" />
            </StackPanel>

            <TextBlock Grid.Row="7" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Код нормы / код поверки" />
            <StackPanel Grid.Row="7" Grid.Column="1" Orientation="Horizontal">
                <TextBox Width="140" Margin="0,0,8,8" Text="{Binding TimeNormCode, UpdateSourceTrigger=PropertyChanged}" />
                <TextBox Width="180" Margin="0,0,0,8" Text="{Binding VerificationCode, UpdateSourceTrigger=PropertyChanged}" />
            </StackPanel>

            <TextBlock Grid.Row="8" Grid.Column="0" Margin="0,0,12,8" VerticalAlignment="Center" Text="Количество поверителей" />
            <TextBox Grid.Row="8" Grid.Column="1" Margin="0,0,0,8" Text="{Binding VerifierCountText, UpdateSourceTrigger=PropertyChanged}" />
        </Grid>

        <DockPanel Grid.Row="1" Margin="0,12,0,0">
            <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center" Foreground="Firebrick" Text="{Binding ValidationMessage}" />
            <StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
                <Button Width="100" Margin="0,0,8,0" IsDefault="True" Command="{Binding ConfirmCommand}" Content="Сохранить" />
                <Button Width="90" Command="{Binding CancelCommand}" Content="Отмена" />
            </StackPanel>
        </DockPanel>
    </Grid>
</Window>
