<UserControl x:Class="ComPDFKit.Controls.PDFControl.PrintPreviewControl"
             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" 
             d:DesignHeight="360" d:DesignWidth="240" Background="#F7F8FA">
    <UserControl.Resources>
        <Style x:Key="PrePageBtnStyle" TargetType="Button">
            <Setter Property="Height" Value="24" />
            <Setter Property="Width" Value="24" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid x:Name="UserfulRegion">
                            <Border
                                x:Name="border"
                                BorderBrush="#5A000000"
                                BorderThickness="1"
                                CornerRadius="4">
                                <Grid>
                                    <Rectangle
                                        Width="24"
                                        Height="24"
                                        Fill="Transparent" />
                                    <Path
                                        x:Name="Path"
                                        Width="24"
                                        Height="24"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center"
                                        Data="M10.0607 12.1L14.6303 7.53039L13.5696 6.46973L8.46967 11.5697C8.17678 11.8626 8.17678 12.3374 8.46967 12.6303L13.5696 17.7303L14.6303 16.6696L10.0607 12.1Z"
                                        Fill="#8A000000" />
                                </Grid>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="border" Property="Background" Value="#cccccc" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="NextPageBtnStyle" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid x:Name="UserfulRegion">
                            <Border
                                x:Name="border"
                                BorderBrush="#5A000000"
                                BorderThickness="1"
                                CornerRadius="4">
                                <Grid>

                                    <Rectangle
                                        Width="24"
                                        Height="24"
                                        Fill="Transparent" />
                                    <Path
                                        x:Name="Path"
                                        Width="24"
                                        Height="24"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center"
                                        Data="M13.9393 12.1L9.36972 7.53039L10.4304 6.46973L15.5303 11.5697C15.8232 11.8626 15.8232 12.3374 15.5303 12.6303L10.4304 17.7303L9.36972 16.6696L13.9393 12.1Z"
                                        Fill="#8A000000" />
                                </Grid>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="border" Property="Background" Value="#cccccc" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
        <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"></RowDefinition>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="40"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal">
            <TextBlock Text="{Binding PaperKind}" Margin="0,0,10,0"></TextBlock>
            <TextBlock Text="size"></TextBlock>
            <TextBlock Text="{Binding PaperWidth}"></TextBlock>
            <TextBlock Text="*"></TextBlock>
            <TextBlock Text="{Binding PaperHeight}"></TextBlock>
        </StackPanel> 
        <Grid Grid.Row="1" Margin="5">
            <Border BorderThickness="1" BorderBrush="#5a000000" Background="#1a000000" Height="{Binding ViewBoxHeight}" Width="{Binding ViewBoxWidth}"> 
                <Viewbox>
                    <Image Name="imgPrint" RenderOptions.BitmapScalingMode="HighQuality" Source="{Binding PreviewBitmapSource}"  Margin="{Binding Margins}">
                    </Image>
                </Viewbox>
            </Border>
        </Grid>
        <StackPanel Grid.Row="2" HorizontalAlignment="Center" Orientation="Horizontal">
            <Button x:Name="btnPreButton" Height="32" Width="36" Style="{StaticResource PrePageBtnStyle}" Margin="0,0,12,0" Click="btnPreButton_Click"></Button>
            <TextBox x:Name="txbPageIndex" Height="32" Width="50" Text="{Binding PaperIndex, UpdateSourceTrigger=PropertyChanged}" LostFocus="txbPageIndex_LostFocus" PreviewLostKeyboardFocus="txbPageIndex_PreviewLostKeyboardFocus" TextAlignment="Center" VerticalContentAlignment="Center"></TextBox>
            <TextBlock Text=" of " VerticalAlignment="Center"></TextBlock>
            <TextBlock  Text="{Binding PrintedPageCount}"  VerticalAlignment="Center"></TextBlock>
            <Button x:Name="btnNextButton" Style="{StaticResource NextPageBtnStyle}" Height="32" Width="36"  Margin="12,0,0,0" Click="btnNextButton_Click"></Button>
        </StackPanel>
    </Grid>
</UserControl>