<hc:Window x:Class="智慧物流软件系统.OutInventoryAddMatView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:智慧物流软件系统"
        mc:Ignorable="d"
        xmlns:hc="https://handyorg.github.io/handycontrol"
        Height="500" Width="900" WindowStyle="None" BorderThickness="0"  Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
    <hc:Window.Resources>
        <ResourceDictionary>
            <Style TargetType="Button" BasedOn="{StaticResource ButtonDefault}">
                <Setter Property="Padding" Value="25,0"></Setter>
            </Style>
        </ResourceDictionary>
    </hc:Window.Resources>

    <Border BorderThickness="1.5" BorderBrush="Black" Background="AliceBlue" CornerRadius="10" >
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="1.2*"></RowDefinition>
                <RowDefinition Height="1.5*"></RowDefinition>
                <RowDefinition Height="9*"></RowDefinition>
                <RowDefinition Height="1.5*"></RowDefinition>
            </Grid.RowDefinitions>

            <Button Margin="-5,-1" Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityConverter}}" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource CloseGeometry}" HorizontalAlignment="Right" VerticalAlignment="Top" Click="closeClick"/>
            <StackPanel Orientation="Vertical">
                <TextBlock Margin="2" FontSize="25" Name="Title" Text="选择物料（双击选中）" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                <hc:Divider Margin="0"/>
            </StackPanel>
            <Border Grid.Row="1" Margin="2 2 2 0" Background="LightGray"  Padding="0">
                <Border   Background="AliceBlue" Padding="0">
                    <Grid >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>


                        <TextBlock Grid.Row="5" Grid.Column="0" Margin="2" FontSize="20" HorizontalAlignment="Right" VerticalAlignment="Center" Text="物料编码：">
                        </TextBlock>
                        <TextBox MinWidth="120"  Grid.Column="1" MaxWidth="120" Text="{Binding MatCode}" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Black" ></TextBox>
                        <TextBlock  Grid.Column="2"  Margin="10 2 2 2" FontSize="20" HorizontalAlignment="Right" VerticalAlignment="Center" Text="物料名称：">
                        </TextBlock>
                        <TextBox  Grid.Column="3" MinWidth="120" MaxWidth="120" Text="{Binding MatName}" Name="txtMatQty1" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Black" >
                        </TextBox>

                        <Button  Grid.Column="4" Style="{StaticResource ButtonSuccess}"
                                            Command="{Binding BtnSearchCommand}"
                                            hc:BorderElement.CornerRadius="10" 
                                            MinHeight="35" FontSize="20" Content="&#xE8B9; 搜索" FontFamily="{StaticResource IconFont}"/>
                    </Grid>
                </Border>
            </Border>

            <Grid Margin="5,0" Grid.Row="2" >
                <DataGrid  Grid.Row="1" 
                           Name="dataGrid"
                           SelectionChanged="DataGrid_SelectionChanged"
                           MouseDoubleClick="dataGrid_MouseDoubleClick"
                           RowHeight="39" 
                           ItemsSource="{Binding DataGridItemSource}"
                           SelectedItem="{Binding SelectedataGridItem}"
                           AutoGenerateColumns="False"   FontSize="14">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn CanUserResize="False">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <RadioButton Width="30" Height="30"  
                                         GroupName="111222333"
                                         IsChecked="{Binding IsSelected , UpdateSourceTrigger=PropertyChanged}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
                        <DataGridTextColumn IsReadOnly="True" Header="物料名称" MaxWidth="200" Binding="{Binding MatName}"></DataGridTextColumn>
                        <DataGridTextColumn IsReadOnly="True" Header="库存数量" Binding="{Binding TotalQty}"></DataGridTextColumn>
                        <DataGridTextColumn IsReadOnly="True" Header="物料规格" MaxWidth="200" Binding="{Binding MatSpec}"></DataGridTextColumn>
                        <DataGridTextColumn IsReadOnly="True" Header="物料批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
                        <DataGridTextColumn IsReadOnly="True" Header="物料客户" Binding="{Binding MatCustomer}"></DataGridTextColumn>
                        <DataGridTextColumn IsReadOnly="True" Header="物料供应商" Binding="{Binding MatSupplier}"></DataGridTextColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </Grid>

            <StackPanel Margin="3" x:Name="spacingPanel" Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
                <Button Margin="0 0 10 0 " Content="选择" Background="ForestGreen" Foreground="White" MinHeight="40" FontSize="21" Click="comfirmClick">
                </Button>
                <Button Margin="10 0 0 0 " Content="取消"  Background="IndianRed" Foreground="White"  MinHeight="40" FontSize="21" Click="closeClick"/>
            </StackPanel>
        </Grid>
    </Border>
</hc:Window>
