<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:HandyControl.Controls"
                    xmlns:interactivity="clr-namespace:HandyControl.Interactivity">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Basic/Paths.xaml"/>
        <ResourceDictionary Source="Button.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="PaginationButtonStyle" TargetType="RadioButton">
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
        <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="GroupName" Value="1"/>
        <Setter Property="Margin" Value="5,0"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="RenderTransformOrigin" Value=".5,.5"/>
        <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
        <Setter Property="Tag" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RadioButton">
                    <Border Height="30" MinWidth="30" x:Name="border" CornerRadius="2" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
                        <TextBlock Margin="6" FontSize="16" Text="{TemplateBinding Tag}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="RenderTransform">
                    <Setter.Value>
                        <TransformGroup>
                            <ScaleTransform ScaleX=".95" ScaleY=".95"/>
                            <SkewTransform/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
                <Setter Property="Foreground" Value="White"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.4"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="controls:Pagination">
        <Setter Property="Height" Value="40"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:Pagination">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <!--向左切换-->
                        <Button x:Name="PART_ButtonLeft" Command="interactivity:ControlCommands.Prev" Margin="5,0" VerticalAlignment="Center" Style="{StaticResource ButtonCustom}">
                            <Border CornerRadius="2" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Width="30" Height="30" Background="{DynamicResource RegionBrush}">
                                <Path Margin="10" Fill="{DynamicResource PrimaryTextBrush}" Style="{StaticResource LeftPathStyle}"/>
                            </Border>
                        </Button>
                        <StackPanel HorizontalAlignment="Center" Grid.Column="1" Orientation="Horizontal">
                            <interactivity:Interaction.Triggers>
                                <interactivity:RoutedEventTrigger RoutedEvent="RadioButton.Checked">
                                    <interactivity:EventToCommand Command="interactivity:ControlCommands.Selected" PassEventArgsToCommand="True" />
                                </interactivity:RoutedEventTrigger>
                            </interactivity:Interaction.Triggers>
                            <RadioButton Name="PART_ButtonFirst" Tag="1" IsChecked="True" Style="{StaticResource PaginationButtonStyle}"/>
                            <TextBlock Name="PART_TextBlockLeft" Margin="10,0" FontSize="16" Text="..." Foreground="{DynamicResource PrimaryTextBrush}" VerticalAlignment="Center" HorizontalAlignment="Center"/>

                            <StackPanel Name="PART_PanelMain" Orientation="Horizontal"/>

                            <TextBlock Name="PART_TextBlockRight" Margin="10,0" FontSize="16" Text="..." Foreground="{DynamicResource PrimaryTextBrush}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            <RadioButton Name="PART_ButtonLast" Tag="10" Style="{StaticResource PaginationButtonStyle}"/>
                        </StackPanel>
                        <!--向右切换-->
                        <Button x:Name="PART_ButtonRight" Grid.Column="2" Command="interactivity:ControlCommands.Next" Margin="5,0" VerticalAlignment="Center" Style="{StaticResource ButtonCustom}">
                            <Border BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" CornerRadius="2" Width="30" Height="30" Background="{DynamicResource RegionBrush}">
                                <Path Margin="10" Fill="{DynamicResource PrimaryTextBrush}" Style="{StaticResource RightPathStyle}" RenderTransformOrigin="0.5,0.5"/>
                            </Border>
                        </Button>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>