<UserControl x:Class="ComPDFKit.Controls.PDFControl.HomePageControl"
             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"
             mc:Ignorable="d" 
               xmlns:common="clr-namespace:ComPDFKit.Controls.Common"
             d:DesignHeight="800" d:DesignWidth="1920"
             Loaded="UserControl_Loaded"
             Unloaded="UserControl_Unloaded" x:Name="HomePage">
    <UserControl.Resources>
        <DrawingImage x:Key="OpenDocumentIcon">
            <DrawingImage.Drawing>
                <DrawingGroup>
                    <GeometryDrawing Brush="#FFFFFFFF">
                        <GeometryDrawing.Geometry>
                            <PathGeometry FillRule="EvenOdd" Figures="M19.8341,0L2,0 2,30 28,30 28,8.2809 19.8341,0z M18,2L18,10 26,10 18,2z M16,14L16,19 21,19 21,21 16,21 16,26 14,26 14,21 9,21 9,19 14,19 14,14 16,14z" />
                        </GeometryDrawing.Geometry>
                    </GeometryDrawing>
                </DrawingGroup>
            </DrawingImage.Drawing>
        </DrawingImage>
        <DrawingImage x:Key="CreateDocumentIcon">
            <DrawingImage.Drawing>
                <DrawingGroup>
                    <GeometryDrawing Brush="#FF001A4E">
                        <GeometryDrawing.Geometry>
                            <PathGeometry FillRule="EvenOdd" Figures="M20.3341,0L2.5,0 2.5,30 28.5,30 28.5,8.2809 20.3341,0z M18.5,2L18.5,10 26.5,10 18.5,2z M16.5,14L16.5,19 21.5,19 21.5,21 16.5,21 16.5,26 14.5,26 14.5,21 9.5,21 9.5,19 14.5,19 14.5,14 16.5,14z" />
                        </GeometryDrawing.Geometry>
                    </GeometryDrawing>
                </DrawingGroup>
            </DrawingImage.Drawing>
        </DrawingImage>
        <Style x:Key="ButtonHoverStyle" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid x:Name="grid" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                            <Border Name="border" Background="Transparent" BorderThickness="1" BorderBrush="#001A4E">
                                <ContentPresenter
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Focusable="False" 
                                    RecognizesAccessKey="True">
                                </ContentPresenter>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter TargetName="border" Property="Background" Value="#AA738199" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <common:HomePageFileListHeightConverter x:Key="HomePageFileListHeightConverter"></common:HomePageFileListHeightConverter>
        <common:CommonResourceConverter x:Key="CommonResourceConverter"></common:CommonResourceConverter>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="260"></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid Margin="30,40" Height="auto" VerticalAlignment="Top"></Grid>
            <StackPanel Grid.Column="0" Margin="0,40,0,0">
                <Button Width="200" Height="64" Background="#001A4E" Click="OpenDocument_Click" Style="{StaticResource ButtonHoverStyle}">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{StaticResource OpenDocumentIcon}" Height="30" Width="30"></Image>
                        <TextBlock Margin="12,0,0,0" VerticalAlignment="Center" Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Button_Open}" Foreground="White" FontFamily="Microsoft YaHei" FontSize="16" LineHeight="24"></TextBlock>
                    </StackPanel>
                </Button>
                
                <Button Width="200" Height="64" Background="White" Margin="0,28,0,0" Click="CreateDocument_Click" Style="{StaticResource ButtonHoverStyle}">
                    <StackPanel Orientation="Horizontal" Margin="5,0,0,0">
                        <Image Source="{StaticResource CreateDocumentIcon}" Height="30" Width="30"></Image>
                        <TextBlock Margin="12,0,0,0" VerticalAlignment="Center" Text="{Binding Converter={StaticResource CommonResourceConverter},ConverterParameter=Button_Create}" Foreground="#001A4E" FontFamily="Microsoft YaHei" FontSize="16" LineHeight="24"></TextBlock>
                    </StackPanel>
                </Button>
            </StackPanel>
        <ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Auto" IsTabStop="True">
            <Grid x:Name="HomeGrid" Background="#F2F2F2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="580" ></RowDefinition>
                    <RowDefinition> </RowDefinition>
                </Grid.RowDefinitions>
                <local:FeaturesListControl x:Name="FeaturesListControl" Margin=" 60,30,0,0"></local:FeaturesListControl>
                <local:RecentFilesControl Grid.Row="1" x:Name="RecentFilesControl" Margin="60,0,0,0" >
                    <local:RecentFilesControl.Height>
                        <MultiBinding Converter="{StaticResource HomePageFileListHeightConverter}">
                            <Binding ElementName="HomePage" Path="ActualHeight"></Binding>
                            <Binding ElementName="FeaturesListControl" Path="ActualHeight"></Binding>
                        </MultiBinding>
                    </local:RecentFilesControl.Height>
                </local:RecentFilesControl>
            </Grid>
        </ScrollViewer>
    </Grid>
</UserControl>
