<Window x:Class="XLAB.SelectInstrumentTypeWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Добавить по типу"
        Height="720"
        Width="1120"
        MinHeight="520"
        MinWidth="900"
        WindowStartupLocation="CenterOwner">
    <Grid Margin="12">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock FontWeight="SemiBold"
                   Text="{Binding CustomerName, StringFormat=Заказчик: {0}}" />

        <StackPanel Grid.Row="1"
                    Margin="0,8,0,8"
                    Orientation="Horizontal">
            <TextBlock Width="150"
                       Margin="0,0,8,0"
                       VerticalAlignment="Center"
                       Text="Поиск" />
            <TextBox Width="320"
                     Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" />
        </StackPanel>

        <DataGrid Grid.Row="2"
                  ItemsSource="{Binding InstrumentTypesView}"
                  SelectedItem="{Binding SelectedType, Mode=TwoWay}"
                  AutoGenerateColumns="False"
                  CanUserAddRows="False"
                  IsReadOnly="True"
                  HeadersVisibility="Column">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Номер госреестра"
                                    Width="120"
                                    Binding="{Binding RegistryNumber}" />
                <DataGridTextColumn Header="Наименование"
                                    Width="240"
                                    Binding="{Binding InstrumentName}" />
                <DataGridTextColumn Header="Тип"
                                    Width="150"
                                    Binding="{Binding InstrumentType}" />
                <DataGridTextColumn Header="Диапазон"
                                    Width="180"
                                    Binding="{Binding RangeText}" />
                <DataGridTextColumn Header="Характеристики"
                                    Width="160"
                                    Binding="{Binding AccuracyText}" />
                <DataGridTextColumn Header="Область"
                                    Width="*"
                                    Binding="{Binding MeasurementArea}" />
            </DataGrid.Columns>
        </DataGrid>

        <StackPanel Grid.Row="3"
                    Margin="0,10,0,0"
                    Orientation="Horizontal">
            <TextBlock Width="150"
                       Margin="0,0,8,0"
                       VerticalAlignment="Center"
                       Text="Заводской номер" />
            <TextBox Width="320"
                     Text="{Binding SerialNumber, UpdateSourceTrigger=PropertyChanged}" />
        </StackPanel>

        <TextBlock Grid.Row="4"
                   Margin="0,8,0,0"
                   Foreground="DimGray"
                   Text="{Binding StatusText}" />

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