<pi:UserControlBase  
        xmlns:pi="https://github.com/ping9719/wpfex"
        x:Class="智慧物流软件系统.MatInfoView"
        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:hc="https://handyorg.github.io/handycontrol" 
    mc:Ignorable="d"
        d:DesignHeight="737" d:DesignWidth="1192" LoadedVisibleFirst="LoadedVisible">
    <Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="0.8*"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="10*"></RowDefinition>
            </Grid.RowDefinitions>
            <Border Grid.Row="0" Margin="5 5 5 0" Background="AliceBlue" CornerRadius="5" Padding="0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1.9*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="1.9*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="1.9*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="1.9*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>

                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" 
                               VerticalAlignment="Center" HorizontalAlignment="Right" 
                               Text="物料编码：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Column="1" 
                               VerticalAlignment="Center" HorizontalAlignment="Stretch" 
                               FontSize="18" MinWidth="90" Text="{Binding MatCode}"></TextBox>

                    <TextBlock Grid.Column="2" 
                               VerticalAlignment="Center" HorizontalAlignment="Right" 
                               Text="物料名称：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Column="3" 
                               VerticalAlignment="Center" HorizontalAlignment="Stretch" 
                               FontSize="18" MinWidth="90" Text="{Binding MatName}"></TextBox>

                    <TextBlock Grid.Column="4" 
                               VerticalAlignment="Center" HorizontalAlignment="Right" 
                               Text="物料规格：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Column="5" 
                               VerticalAlignment="Center" HorizontalAlignment="Stretch" 
                               FontSize="18" MinWidth="90" Text="{Binding MatSpec}"></TextBox>

                    <TextBlock Grid.Column="6" 
                               VerticalAlignment="Center" HorizontalAlignment="Right" 
                               Text="物料条码：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Column="7" 
                              VerticalAlignment="Center" HorizontalAlignment="Stretch" 
                              FontSize="18" MinWidth="90" Text="{Binding MatSN}"></TextBox>

                    <Button Style="{StaticResource ButtonSuccess}"  hc:BorderElement.CornerRadius="15" 
                            Grid.Column="9" MinHeight="40" FontSize="18" Content="&#xe8b9; 搜索" FontFamily="{StaticResource IconFont}"
                            Command="{Binding BtnSearchCommand}">
                    </Button>
                    <Button Style="{StaticResource ButtonWarning}"  hc:BorderElement.CornerRadius="15" 
                            Grid.Column="10" MinHeight="40" FontSize="18" Content="&#xe652; 重置" FontFamily="{StaticResource IconFont}"
                            Command="{Binding BtnResetCommand}">
                    </Button>
                </Grid>
            </Border>
            <Border Grid.Row="1" Margin="5 5 5 0" Background="AliceBlue" CornerRadius="5" Padding="0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1.9*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="1.9*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="1.9*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="1.9*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>

                        <ColumnDefinition Width="2*"></ColumnDefinition>
                        <ColumnDefinition Width="2*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" 
                            VerticalAlignment="Center" HorizontalAlignment="Right" 
                            Text="物料批次：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Column="1" 
                            VerticalAlignment="Center" HorizontalAlignment="Stretch" 
                            FontSize="18" MinWidth="90" Text="{Binding MatBatch}"></TextBox>

                    <TextBlock 
                            Grid.Column="2" 
                            VerticalAlignment="Center" HorizontalAlignment="Right" 
                            Text="已 打 印：" FontSize="18" ></TextBlock>
                    <ComboBox Grid.Column="3" 
                              DisplayMemberPath="Text"  
                              SelectedValuePath="Value"  
                              ItemsSource="{Binding IsPrintedItemSource}"
                              SelectedValue="{Binding IsPrinted}"
                              Height="35" FontSize="18">
                    </ComboBox>

                </Grid>
            </Border>
            <Border Grid.Row="2" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0.8*"></RowDefinition>
                        <RowDefinition Height="9*"></RowDefinition>
                        <RowDefinition Height="0.8*"></RowDefinition>
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0" Orientation="Horizontal">
                        <Button MinHeight="40" FontSize="18" Margin="4" hc:BorderElement.CornerRadius="6" 
                                Content="&#xe7f8;打印/补打" FontFamily="{StaticResource IconFont}"
                                Command="{Binding BtnPrintCommand}"
                                Foreground="WhiteSmoke"
                                Background="DarkOrange">
                        </Button>
                    </StackPanel>

                    <DataGrid 
                        Grid.Row="1" 
                        SelectionChanged="DataGrid_SelectionChanged"
                        MouseLeftButtonDown="DataGrid_MouseLeftButtonDown"
                        SelectedItem="{Binding SelectedataGridItem}"
                        Name="dataGrid"
                        SelectionMode="Extended"
                        ItemsSource="{Binding DataGridItemSource}" 
                        RowHeight="39" 
                        AutoGenerateColumns="False"  FontSize="13">
                        <DataGrid.Columns>
                            <DataGridTemplateColumn CanUserResize="False">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox Width="30" Height="30" IsHitTestVisible="False" IsChecked="{Binding IsSelected}"/>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                                <DataGridTemplateColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <CheckBox Width="30" Height="30"  Unchecked="allChecked_Unchecked" Checked="allChecked_Checked"  Name="allChecked"/>
                                    </DataTemplate>
                                </DataGridTemplateColumn.HeaderTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="物料名称" MaxWidth="150" Binding="{Binding MatName}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="物料规格" MaxWidth="150" Binding="{Binding MatSpec}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="物料批次" MaxWidth="150"  Binding="{Binding MatBatch}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="物料数量" MaxWidth="150"  Binding="{Binding MatQty}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="供应商" MaxWidth="150"  Binding="{Binding MatSupplier}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="客户" MaxWidth="150"  Binding="{Binding MatCustomer}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="物料SN" Binding="{Binding MatSN}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="已打印" Binding="{Binding IsPrinted,Converter={StaticResource Boolean2StringConverter},ConverterParameter=否;是}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="打印次数" Binding="{Binding PrintedTimes}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="更新人" Binding="{Binding ModifyUser}"></DataGridTextColumn>
                            <DataGridTextColumn IsReadOnly="True" Header="更新时间" Binding="{Binding ModifyTime ,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>

                    <Grid Grid.Row="2">
                        <Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
                            <Grid HorizontalAlignment="Stretch"  Margin="0" VerticalAlignment="Top" Width="Auto" MinHeight="26">
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                </Grid.ColumnDefinitions>

                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录  "></TextBlock>



                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>

                                    <ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
                                        <ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="20">20条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="50">50条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="100">100条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="500">500条/页</ComboBoxItem>
                                    </ComboBox>
                                </StackPanel>

                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
                                    <Grid>
                                        <Grid.RowDefinitions >
                                            <RowDefinition Height="30"></RowDefinition>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                        </Grid.ColumnDefinitions>

                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="0" Name="btnFirst" Content="首页" Foreground="Black" FontSize="14" 
                            Command="{Binding BtnFirstPageCommand}"/>
                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="1" Name="btnPrev" Content="上一页" FontSize="14" 
                            Command="{Binding BtnPrePageCommand}"/>
                                        <TextBox BorderBrush="Transparent" Grid.Column="2" FontSize="14" MinWidth="50"   HorizontalAlignment="Center" VerticalAlignment="Center"  Cursor="IBeam" IsEnabled="False"
                             Text ="{Binding CurrentPage}" TextAlignment="Center"/>
                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="3" Name="btnNext" Content="下一页" FontSize="14" 
                            Command="{Binding BtnNextPageCommand}"/>
                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="4" Name="btnLast" Content="末页" FontSize="14" 
                            Command="{Binding BtnLastPageCommand}"/>
                                    </Grid>
                                </StackPanel>

                            </Grid>
                        </Border>
                    </Grid>
                </Grid>
            </Border>
        </Grid>
    </Border>
</pi:UserControlBase>
