<UserControl x:Class="ComPDFKit.Controls.PDFControl.FileGridListWithPageRangeControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:ComPDFKit.Controls.PDFControl"
             xmlns:common="clr-namespace:ComPDFKit.Controls.Common" 
             Loaded="UserControl_Loaded" 
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="500">
    <UserControl.Resources>
        <ResourceDictionary>
            <common:SecurityResourceConverter x:Key="SecurityResourceConverter"/>
            <Style x:Key="CustomDataGridStyle" TargetType="DataGrid">
                <Setter Property="BorderBrush" Value="#E6E6E6" />
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="CellStyle">
                    <Setter.Value>
                        <Style TargetType="DataGridCell">
                            <Setter Property="BorderThickness" Value="1" />
                            <Setter Property="BorderBrush" Value="#E6E6E6" />
                        </Style>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Margin="10,0,10,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="50"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>

        <DockPanel Grid.Row="0" Grid.Column="0">
            <Button x:Name="AddFilesBtn" Content="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Button_AddFiles}" Height="32" MinWidth="112" FontFamily="Microsoft YaHei" FontSize="14" Padding="28,6,27,6" HorizontalAlignment="Left" Click="AddFilesBtn_Click"></Button>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0">
                <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_FileCount}" FontFamily="Microsoft YaHei" FontSize="14"></TextBlock>
                <TextBlock FontFamily="Microsoft YaHei" FontSize="14" Text="{Binding FileNumText}" Margin="5,0,0,0"></TextBlock>
            </StackPanel>
        </DockPanel>

        <Border Grid.Row="1" Grid.Column="0" BorderBrush="#CCCCCC" BorderThickness="1">
            <Grid Margin="10,10,10,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="50"></RowDefinition>
                </Grid.RowDefinitions>
                <Grid Grid.Row="0" VerticalAlignment="Stretch">
                    <DataGrid Background="White" BorderBrush="#E6E6E6" x:Name="FileDataGrid" HeadersVisibility="Column"
                               IsReadOnly="True" AutoGenerateColumns="False" FontSize="14" SelectionMode="Extended"
                               ScrollViewer.CanContentScroll="False" HorizontalScrollBarVisibility="Auto" SelectionChanged="FileDataGrid_SelectionChanged"
                              MouseLeftButtonDown="FileDataGrid_MouseLeftButtonDown">
                        <DataGrid.Columns>
                            <DataGridTextColumn Width="*" Binding="{Binding Name}" >
                                <DataGridTextColumn.Header>
                                    <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter},ConverterParameter=Table_FileName}"/>
                                </DataGridTextColumn.Header>
                            </DataGridTextColumn>
                            <DataGridTextColumn Width="*" Binding="{Binding Size}">
                                <DataGridTextColumn.Header>
                                    <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter},ConverterParameter=Table_FileSize}"/>
                                </DataGridTextColumn.Header>
                            </DataGridTextColumn>
                            <DataGridTextColumn Width="*" Binding="{Binding PageRange}">
                                <DataGridTextColumn.Header>
                                    <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter},ConverterParameter=Table_PageRange}"/>
                                </DataGridTextColumn.Header>
                            </DataGridTextColumn>
                            <DataGridTextColumn Width="*" Binding="{Binding Path}">
                                <DataGridTextColumn.Header>
                                    <TextBlock Text="{Binding Converter={StaticResource SecurityResourceConverter},ConverterParameter=Table_Path}"/>
                                </DataGridTextColumn.Header>
                            </DataGridTextColumn>
                        </DataGrid.Columns>
                        <DataGrid.Resources>
                            <Style TargetType="DataGrid">
                                <Setter Property="HorizontalGridLinesBrush" Value="#E6E6E6" />
                                <Setter Property="VerticalGridLinesBrush" Value="#E6E6E6" />
                            </Style>
                            <Style TargetType="DataGridColumnHeader">
                                <Setter Property="Foreground" Value="#666666" />
                                <Setter Property="FontFamily" Value="Microsoft YaHei" />
                                <Setter Property="FontSize" Value="12" />
                            </Style>
                            <Style TargetType="DataGridCell">
                                <Setter Property="FontFamily" Value="Microsoft YaHei" />
                                <Setter Property="FontSize" Value="12" />
                                <Setter Property="Foreground" Value="#666666" />
                                <Setter Property="BorderThickness" Value="0"></Setter>
                                <Style.Triggers>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Background" Value="#0078D7" />
                                        <Setter Property="Foreground" Value="White" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </DataGrid.Resources>
                    </DataGrid>
                </Grid>
                <StackPanel Grid.Row="1" Orientation="Horizontal">
                    <Button x:Name="RemoveBtn" FontFamily="Microsoft YaHei" FontSize="14" Content="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Button_RemoveAll}" MinWidth="112" Height="32" HorizontalAlignment="Left" Padding="5,0,5,0" Click="RemoveBtn_Click"></Button>
                    <Button x:Name="PageRangeBtn" FontFamily="Microsoft YaHei" FontSize="14" Content="{Binding Converter={StaticResource SecurityResourceConverter}, ConverterParameter=Text_PageRange}" MinWidth="112" Height="32" HorizontalAlignment="Left" Margin="20,0,0,0" Padding="5,0,5,0"  Visibility="Collapsed" Click="PageRangeBtn_Click"></Button>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>
