<UserControl x:Class="ComPDFKit.Controls.PDFControl.RecentFilesControl"
             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"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <Style TargetType="ListBox" x:Key="HistoryListBoxStyle">
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="BorderBrush" Value="Transparent" />
            <Setter Property="Padding" Value="0" />
        </Style>
        <DrawingImage x:Key="FileIcon">
            <DrawingImage.Drawing>
                  <DrawingGroup>
                      <GeometryDrawing Brush="#FFFF494F">
                        <GeometryDrawing.Geometry>
                          <PathGeometry FillRule="EvenOdd" Figures="M0,2.5C0,1.3954,0.8954,0.5,2,0.5L15.3431,0.5C16.404,0.5,17.4214,0.9214,18.1716,1.6716L24.8284,8.3284C25.5786,9.0786,26,10.096,26,11.1569L26,30.5C26,31.6046,25.1046,32.5,24,32.5L2,32.5C0.8954,32.5,0,31.6046,0,30.5L0,2.5z" />
                        </GeometryDrawing.Geometry>
                      </GeometryDrawing>
                      <DrawingGroup>
                        <GeometryDrawing>
                          <GeometryDrawing.Brush>
                            <SolidColorBrush Color="#FFFFFFFF" Opacity="0.3" />
                          </GeometryDrawing.Brush>
                          <GeometryDrawing.Geometry>
                            <PathGeometry FillRule="EvenOdd" Figures="M21,5.5L12,5.5 12,10.5 21,10.5 21,5.5z M5,9L10,9 10,10.5 5,10.5 5,9z M5,12.5L21,12.5 21,14 5,14 5,12.5z M5,5.5L10,5.5 10,7 5,7 5,5.5z M21,16L5,16 5,17.5 21,17.5 21,16z" />
                          </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                        <GeometryDrawing Brush="#FFFFFFFF">
                          <GeometryDrawing.Geometry>
                            <PathGeometry FillRule="EvenOdd" Figures="M18.6035,23.0586L18.6035,26.5 17.4629,26.5 17.4629,23.0586 16.7676,23.0586 16.7676,22.1992 17.4629,22.1992 17.4629,21.7969C17.4629,20.9414 17.9004,20.5117 18.9395,20.5117 19.1699,20.5117 19.3613,20.5312 19.5254,20.5547L19.5254,21.3164C19.4551,21.3047 19.334,21.293 19.1855,21.293 18.7441,21.293 18.5801,21.5 18.5801,21.875L18.5801,22.1992 19.4902,22.1992 19.4902,23.0586 18.6035,23.0586z M14.7402,25.832C14.5176,26.2969 14.0605,26.5664 13.4551,26.5664 12.3809,26.5664 11.709,25.7266 11.709,24.3516L11.709,24.3438C11.709,22.9609 12.3652,22.1289 13.4551,22.1289 14.0449,22.1289 14.5254,22.418 14.7402,22.8867L14.8105,22.8867 14.8105,20.5547 15.9512,20.5547 15.9512,26.5 14.8105,26.5 14.8105,25.832 14.7402,25.832z M7.8848,27.9258L7.8848,25.8125 7.9551,25.8125C8.1738,26.2812 8.6543,26.5664 9.2441,26.5664 10.334,26.5664 10.9902,25.7344 10.9902,24.3516L10.9902,24.3438C10.9902,22.9727 10.3184,22.1289 9.2441,22.1289 8.6348,22.1289 8.1777,22.4023 7.9551,22.8633L7.8848,22.8633 7.8848,22.1992 6.7441,22.1992 6.7441,27.9258 7.8848,27.9258z M8.8535,25.6211C8.2559,25.6211,7.8731,25.1406,7.8731,24.3516L7.8731,24.3438C7.8731,23.5547 8.252,23.0742 8.8535,23.0742 9.459,23.0742 9.8301,23.5547 9.8301,24.3438L9.8301,24.3516C9.8301,25.1406,9.4551,25.6211,8.8535,25.6211z M13.8418,25.6211C13.2402,25.6211,12.8691,25.1445,12.8691,24.3516L12.8691,24.3438C12.8691,23.5586 13.2402,23.0742 13.8418,23.0742 14.4434,23.0742 14.8223,23.5586 14.8223,24.3477L14.8223,24.3555C14.8223,25.1445,14.4473,25.6211,13.8418,25.6211z" />
                          </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                        <DrawingGroup>
                          <GeometryDrawing Brush="#FFFFB1B4">
                            <GeometryDrawing.Geometry>
                              <PathGeometry FillRule="EvenOdd" Figures="M17,0.5L26,9.5 19,9.5C17.8954,9.5,17,8.6046,17,7.5L17,0.5z" />
                            </GeometryDrawing.Geometry>
                          </GeometryDrawing>
                        </DrawingGroup>
                      </DrawingGroup>
                    </DrawingGroup>
            </DrawingImage.Drawing>
        </DrawingImage>
        <Style x:Key="ItemContainerStyle" TargetType="ListViewItem">
            <EventSetter Event="MouseDoubleClick" Handler="ListViewItem_DoubleClick"></EventSetter>
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListViewItem">
                        <Grid>
                            <Border x:Name="Bd"
                                    Background="Transparent"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}">
                                <ContentPresenter/>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsMouseOver" Value="True"/>
                                    <Condition Property="IsSelected" Value="False"/>
                                </MultiTrigger.Conditions>
                                <Setter TargetName="Bd" Property="Background" Value="#D3D5D9"/>
                            </MultiTrigger>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="Bd" Property="Background" Value="#2A365DDB"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <common:CommonResourceConverter x:Key="CommonResourceConverter" />
    </UserControl.Resources>
    <Grid Margin="0,0,20,0" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <TextBlock Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Title_QuickStart}" Background="Transparent" Margin="0,0,0,25" Height="32" FontFamily="Microsoft YaHei" FontSize="24" LineHeight="32" Foreground="#001A4E" FontWeight="DemiBold"></TextBlock>
        <ListView Grid.Row="1" x:Name="HistoryListView" MinWidth="380"
                  ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                  Style="{StaticResource HistoryListBoxStyle}" ItemsSource="{Binding History}" 
                  ItemContainerStyle="{StaticResource ItemContainerStyle}"
                  d:ItemsSource="{d:SampleData ItemCount=10}" SelectionMode="Single" 
                  Background="Transparent"
                  VirtualizingPanel.CacheLength="1"
                  VirtualizingPanel.CacheLengthUnit="Page"
                  VirtualizingPanel.IsVirtualizing="True"
                  VirtualizingPanel.ScrollUnit="Pixel"
                  VirtualizingPanel.VirtualizationMode="Standard">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="0,0,20,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="4*" />
                            <ColumnDefinition Width="2*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <Image Grid.Column="0" Width="20" Height="20" Source="{StaticResource FileIcon}"/>

                        <StackPanel Grid.Column="1" Orientation="Vertical" Margin="5">
                            <TextBlock Text="{Binding FileName}" TextTrimming="CharacterEllipsis" Foreground="#001A4E" FontFamily="SF Pro" FontSize="16" LineHeight="21"/>
                            <TextBlock Text="{Binding FilePath}" TextTrimming="CharacterEllipsis" Foreground="#666" FontFamily="Microsoft YaHei" FontSize="12" LineHeight="16"/>
                        </StackPanel>

                        <TextBlock Visibility="Hidden" Grid.Column="2" Margin="20,0,0,0" VerticalAlignment="Center" Text="{Binding OpenDate}" TextTrimming="CharacterEllipsis" Foreground="#666" FontFamily="Microsoft YaHei" FontSize="14" LineHeight="20"/>

                        <TextBlock Grid.Column="3" Margin="20,0,0,0" VerticalAlignment="Center" Text="{Binding FileSize}" TextTrimming="CharacterEllipsis" Foreground="#666" FontFamily="Microsoft YaHei" FontSize="14" LineHeight="20"/>
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </Grid>
</UserControl>
