<UserControl x:Class="Platform.Controls.ComponentContainer.DataPager"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:dhcc="http://www.dhcc.com.cn"
             xmlns:Helper="clr-namespace:Platform.Controls.ControlsHelper"
             xmlns:local="clr-namespace:Platform.Controls.BaseContainer"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             x:Name="dp"
             Margin="3"
             d:DesignHeight="46"
             d:DesignWidth="577"
             Loaded="DataPager_Loaded"
             mc:Ignorable="d">
    <Grid>

        <Grid.Resources>
            <!--
                <Style TargetType="{x:Type Image}">
                <Setter Property="Margin" Value="3,0,3,0" />
                <Setter Property="Cursor" Value="Hand" />
                </Style>
            -->
        </Grid.Resources>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <ComboBox Name="cboPageSize" MinWidth="40"
                  VerticalAlignment="Center"
                  ItemsSource="{Binding Path=PageSizeItems,
                                        ElementName=dp}"
                  SelectedItem="{Binding PageSize,
                                         Mode=TwoWay,
                                         ElementName=dp}"
                  SelectionChanged="cbpPageSize_SelectionChanged"
                  Height="21"
                  Style="{x:Null}" HorizontalAlignment="Left" Margin="0,6" Width="40" />
        <StackPanel Grid.Column="1"
                    VerticalAlignment="Center"
                    Orientation="Horizontal">

            <local:ImageButton x:Name="btnFirst"
                               Click="btnFirst_Click" Style="{x:Null}"
                               GrayImageSource="/Platform.Controls;component/Resource/pagination_first_gray.gif"
                               ImageSource="/Platform.Controls;component/Resource/pagination_first.gif" />
            <local:ImageButton x:Name="btnPrev"
                               Click="btnPrev_Click" Style="{x:Null}"
                               GrayImageSource="/Platform.Controls;component/Resource/pagination_prev_gray.gif"
                               ImageSource="/Platform.Controls;component/Resource/pagination_prev.gif" />

            <TextBox Name="tbPageIndex"
                     Width="{Binding Path=PageCountLength}" 
                     Margin="5,0,0,0"
                     VerticalContentAlignment="Center"
                     LostFocus="tbPageIndex_LostFocus"
                     PreviewKeyDown="tbPageIndex_PreviewKeyDown"
                     Style="{x:Null}"
                     Text="{Binding Path=PageIndex,
                                    ElementName=dp}" />
            <TextBlock Margin="5,0,0,0"
                       VerticalAlignment="Center" Style="{x:Null}"
                       Text="/" />
            <TextBlock Margin="5,0" Style="{x:Null}"
                       VerticalAlignment="Center"
                       Text="{Binding Path=PageCount,
                                      ElementName=dp}" />

            <local:ImageButton x:Name="btnNext" Style="{x:Null}"
                               Click="btnNext_Click"
                               GrayImageSource="/Platform.Controls;component/Resource/pagination_next_gray.gif"
                               ImageSource="/Platform.Controls;component/Resource/pagination_next.gif" />
            <local:ImageButton x:Name="btnLast" Style="{x:Null}"
                               Click="btnLast_Click"
                               GrayImageSource="/Platform.Controls;component/Resource/pagination_last_gray.gif"
                               ImageSource="/Platform.Controls;component/Resource/pagination_last.gif" />
            <local:ImageButton Click="btnRefresh_Click" Style="{x:Null}"
                               GrayImageSource="/Platform.Controls;component/Resource/pagination_loading.gif"
                               ImageSource="/Platform.Controls;component/Resource/pagination_load.png" />
        </StackPanel>
        <TextBlock Grid.Column="2" Style="{x:Null}"
                   HorizontalAlignment="Right"
                   VerticalAlignment="Center">
            共
            <TextBlock Text="{Binding Path=Total, ElementName=dp}" Style="{x:Null}"/>
            条记录
        </TextBlock>
    </Grid>
</UserControl>
