add Pagination
This commit is contained in:
1 parent
e55a353dbe
commit
53603b4648
10 files changed
+555
-21
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<UserControl x:Class="HandyControl.Controls.Pagination"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
Height="40"
|
||||
Visibility="Collapsed"
|
||||
UseLayoutRounding="True"
|
||||
Name="MyUserControl"
|
||||
Background="Transparent">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!--向左切换-->
|
||||
<Button Name="LeftButton" Click="ButtonPrev_OnClick" Margin="5,0" VerticalAlignment="Center" Background="{x:Null}" Style="{StaticResource ButtonOpacityStyle}">
|
||||
<Border CornerRadius="2" BorderThickness="1" BorderBrush="{StaticResource BorderBrush}" Width="30" Height="30" Background="White">
|
||||
<Path Margin="10" Fill="{StaticResource PrimaryTextBrush}" Style="{StaticResource LeftPathStyle}"></Path>
|
||||
</Border>
|
||||
</Button>
|
||||
<StackPanel HorizontalAlignment="Center" Grid.Column="1" RadioButton.Checked="ToggleButton_OnChecked" Orientation="Horizontal">
|
||||
<RadioButton Name="FirstButton" Tag="1" IsChecked="True" Style="{StaticResource PaginationButtonStyle}"></RadioButton>
|
||||
<TextBlock Name="LeftTextBlock" Margin="10,0" FontSize="16" Text="..." Foreground="{DynamicResource PrimaryTextBrush}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
|
||||
|
||||
<StackPanel Name="MainPanel" Orientation="Horizontal"></StackPanel>
|
||||
|
||||
<TextBlock Name="RightTextBlock" Margin="10,0" FontSize="16" Text="..." Foreground="{DynamicResource PrimaryTextBrush}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
|
||||
<RadioButton Name="LastButton" Tag="10" Style="{StaticResource PaginationButtonStyle}"></RadioButton>
|
||||
</StackPanel>
|
||||
<!--向右切换-->
|
||||
<Button Grid.Column="2" Name="RightButton" Click="ButtonNext_OnClick" Margin="5,0" VerticalAlignment="Center" Background="{x:Null}" Style="{StaticResource ButtonOpacityStyle}">
|
||||
<Border BorderThickness="1" BorderBrush="{StaticResource BorderBrush}" CornerRadius="2" Width="30" Height="30" Background="White">
|
||||
<Path Margin="10" Fill="{StaticResource PrimaryTextBrush}" Style="{StaticResource RightPathStyle}" RenderTransformOrigin="0.5,0.5"></Path>
|
||||
</Border>
|
||||
</Button>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,266 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools.Extension;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Pagination.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class Pagination
|
||||
{
|
||||
/// <summary>
|
||||
/// 页面更新事件
|
||||
/// </summary>
|
||||
public static readonly RoutedEvent PageUpdatedEvent =
|
||||
EventManager.RegisterRoutedEvent("PageUpdated", RoutingStrategy.Bubble,
|
||||
typeof(EventHandler<FunctionEventArgs<int>>), typeof(Pagination));
|
||||
|
||||
public Pagination() => InitializeComponent();
|
||||
|
||||
/// <summary>
|
||||
/// 最大页数
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty MaxPageCountProperty = DependencyProperty.Register(
|
||||
"MaxPageCount", typeof(int), typeof(Pagination), new PropertyMetadata(1, (o, args) =>
|
||||
{
|
||||
if (o is Pagination pagination && args.NewValue is int value)
|
||||
{
|
||||
if (pagination.PageIndex > pagination.MaxPageCount)
|
||||
{
|
||||
pagination.PageIndex = pagination.MaxPageCount;
|
||||
}
|
||||
pagination.Show(value > 1);
|
||||
pagination.Update();
|
||||
}
|
||||
}, (o, value) =>
|
||||
{
|
||||
if (!(o is Pagination)) return 1;
|
||||
var intValue = (int)value;
|
||||
if (intValue < 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return intValue;
|
||||
}));
|
||||
|
||||
/// <summary>
|
||||
/// 最大页数
|
||||
/// </summary>
|
||||
public int MaxPageCount
|
||||
{
|
||||
get => (int)GetValue(MaxPageCountProperty);
|
||||
set => SetValue(MaxPageCountProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 每页的数据量
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty DataCountPerPageProperty = DependencyProperty.Register(
|
||||
"DataCountPerPage", typeof(int), typeof(Pagination), new PropertyMetadata(20, (o, args) =>
|
||||
{
|
||||
if (o is Pagination pagination && args.NewValue is int)
|
||||
{
|
||||
pagination.Update();
|
||||
}
|
||||
}, (o, value) =>
|
||||
{
|
||||
if (!(o is Pagination)) return 1;
|
||||
var intValue = (int)value;
|
||||
if (intValue < 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return intValue;
|
||||
}));
|
||||
|
||||
/// <summary>
|
||||
/// 每页的数据量
|
||||
/// </summary>
|
||||
public int DataCountPerPage
|
||||
{
|
||||
get => (int)GetValue(DataCountPerPageProperty);
|
||||
set => SetValue(DataCountPerPageProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前页
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty PageIndexProperty = DependencyProperty.Register(
|
||||
"PageIndex", typeof(int), typeof(Pagination), new PropertyMetadata(1, (o, args) =>
|
||||
{
|
||||
if (o is Pagination pagination && args.NewValue is int value)
|
||||
{
|
||||
pagination.Update();
|
||||
pagination.RaiseEvent(new FunctionEventArgs<int>(PageUpdatedEvent, pagination)
|
||||
{
|
||||
Info = value
|
||||
});
|
||||
}
|
||||
}, (o, value) =>
|
||||
{
|
||||
if (!(o is Pagination pagination)) return 1;
|
||||
var intValue = (int)value;
|
||||
if (intValue < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (intValue > pagination.MaxPageCount) return pagination.MaxPageCount;
|
||||
return intValue;
|
||||
}));
|
||||
|
||||
/// <summary>
|
||||
/// 当前页
|
||||
/// </summary>
|
||||
public int PageIndex
|
||||
{
|
||||
get => (int)GetValue(PageIndexProperty);
|
||||
set => SetValue(PageIndexProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 表示当前选中的按钮距离左右两个方向按钮的最大间隔(4表示间隔4个按钮,如果超过则用省略号表示)
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty MaxPageIntervalProperty = DependencyProperty.Register(
|
||||
"MaxPageInterval", typeof(int), typeof(Pagination), new PropertyMetadata(3, (o, args) =>
|
||||
{
|
||||
if (o is Pagination pagination)
|
||||
{
|
||||
pagination.Update();
|
||||
}
|
||||
}), value =>
|
||||
{
|
||||
var intValue = (int)value;
|
||||
return intValue >= 0;
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// 表示当前选中的按钮距离左右两个方向按钮的最大间隔(4表示间隔4个按钮,如果超过则用省略号表示)
|
||||
/// </summary>
|
||||
public int MaxPageInterval
|
||||
{
|
||||
get => (int)GetValue(MaxPageIntervalProperty);
|
||||
set => SetValue(MaxPageIntervalProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 页面更新事件
|
||||
/// </summary>
|
||||
public event EventHandler<FunctionEventArgs<int>> PageUpdated
|
||||
{
|
||||
add => AddHandler(PageUpdatedEvent, value);
|
||||
remove => RemoveHandler(PageUpdatedEvent, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新
|
||||
/// </summary>
|
||||
private void Update()
|
||||
{
|
||||
LeftButton.IsEnabled = PageIndex > 1;
|
||||
RightButton.IsEnabled = PageIndex < MaxPageCount;
|
||||
if (MaxPageInterval == 0)
|
||||
{
|
||||
FirstButton.Visibility = Visibility.Collapsed;
|
||||
LastButton.Visibility = Visibility.Collapsed;
|
||||
LeftTextBlock.Visibility = Visibility.Collapsed;
|
||||
RightTextBlock.Visibility = Visibility.Collapsed;
|
||||
MainPanel.Children.Clear();
|
||||
var selectButton = CreateButton(PageIndex);
|
||||
MainPanel.Children.Add(selectButton);
|
||||
selectButton.IsChecked = true;
|
||||
return;
|
||||
}
|
||||
FirstButton.Visibility = Visibility.Visible;
|
||||
LastButton.Visibility = Visibility.Visible;
|
||||
LeftTextBlock.Visibility = Visibility.Visible;
|
||||
RightTextBlock.Visibility = Visibility.Visible;
|
||||
|
||||
//更新最后一页
|
||||
if (MaxPageCount == 1)
|
||||
{
|
||||
LastButton.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
LastButton.Visibility = Visibility.Visible;
|
||||
LastButton.Tag = MaxPageCount.ToString();
|
||||
}
|
||||
|
||||
//更新省略号
|
||||
var right = MaxPageCount - PageIndex;
|
||||
var left = PageIndex - 1;
|
||||
RightTextBlock.Visibility = right > MaxPageInterval ? Visibility.Visible : Visibility.Collapsed;
|
||||
LeftTextBlock.Visibility = left > MaxPageInterval ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
//更新中间部分
|
||||
MainPanel.Children.Clear();
|
||||
if (PageIndex > 1 && PageIndex < MaxPageCount)
|
||||
{
|
||||
var selectButton = CreateButton(PageIndex);
|
||||
MainPanel.Children.Add(selectButton);
|
||||
selectButton.IsChecked = true;
|
||||
}
|
||||
else if (PageIndex == 1)
|
||||
{
|
||||
FirstButton.IsChecked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LastButton.IsChecked = true;
|
||||
}
|
||||
|
||||
var sub = PageIndex;
|
||||
for (int i = 0; i < MaxPageInterval - 1; i++)
|
||||
{
|
||||
if (--sub > 1)
|
||||
{
|
||||
MainPanel.Children.Insert(0, CreateButton(sub));
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
var add = PageIndex;
|
||||
for (int i = 0; i < MaxPageInterval - 1; i++)
|
||||
{
|
||||
if (++add < MaxPageCount)
|
||||
{
|
||||
MainPanel.Children.Add(CreateButton(add));
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonPrev_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PageIndex--;
|
||||
}
|
||||
|
||||
private void ButtonNext_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PageIndex++;
|
||||
}
|
||||
|
||||
private RadioButton CreateButton(int page)
|
||||
{
|
||||
return new RadioButton
|
||||
{
|
||||
Style = FindResource("PaginationButtonStyle") as Style,
|
||||
Tag = page.ToString()
|
||||
};
|
||||
}
|
||||
|
||||
private void ToggleButton_OnChecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!(e.OriginalSource is RadioButton button)) return;
|
||||
PageIndex = int.Parse(button.Tag.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,9 @@
|
||||
<Compile Include="Controls\Loading\LoadingBase.cs" />
|
||||
<Compile Include="Controls\Loading\LoadingCircle.cs" />
|
||||
<Compile Include="Controls\Loading\LoadingLine.cs" />
|
||||
<Compile Include="Controls\Pagination.xaml.cs">
|
||||
<DependentUpon>Pagination.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Data\ColorRange.cs" />
|
||||
<Compile Include="Data\Enum\IpType.cs" />
|
||||
<Compile Include="Data\Enum\TextType.cs" />
|
||||
@@ -121,6 +124,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Controls\Pagination.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Basic\Basic.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -185,6 +192,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\ScrollViewerBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Base\TextBlockBaseStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -205,6 +216,14 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Pagination.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\ScrollViewer.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\Styles\Slider.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style x:Key="ScrollBarBaseRepeatButton" TargetType="{x:Type RepeatButton}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Focusable" Value="false"/>
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type RepeatButton}">
|
||||
<Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ScrollBarBaseThumbVertical" TargetType="{x:Type Thumb}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Thumb}">
|
||||
<Rectangle x:Name="rectangle" RadiusX="4" RadiusY="4" Height="{TemplateBinding Height}" SnapsToDevicePixels="True" Width="{TemplateBinding Width}" Fill="{TemplateBinding Background}"/>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Fill" TargetName="rectangle" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsDragging" Value="true">
|
||||
<Setter Property="Fill" TargetName="rectangle" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ScrollBarBaseThumbHorizontal" TargetType="{x:Type Thumb}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="true"/>
|
||||
<Setter Property="IsTabStop" Value="false"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Thumb}">
|
||||
<Rectangle x:Name="rectangle" RadiusX="4" RadiusY="4" Height="{TemplateBinding Height}" SnapsToDevicePixels="True" Width="{TemplateBinding Width}" Fill="{TemplateBinding Background}"/>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Fill" TargetName="rectangle" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsDragging" Value="true">
|
||||
<Setter Property="Fill" TargetName="rectangle" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ScrollBarBaseStyle" TargetType="{x:Type ScrollBar}">
|
||||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource ThirdlyTextBrush}"></Setter>
|
||||
<Setter Property="Background" Value="Transparent"></Setter>
|
||||
<Setter Property="Focusable" Value="False"></Setter>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Width" Value="8"/>
|
||||
<Setter Property="MinWidth" Value="8"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ScrollBar}">
|
||||
<Grid x:Name="Bg" SnapsToDevicePixels="true">
|
||||
<Border Background="{TemplateBinding Background}" />
|
||||
<Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
|
||||
<Track.DecreaseRepeatButton>
|
||||
<RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource ScrollBarBaseRepeatButton}"/>
|
||||
</Track.DecreaseRepeatButton>
|
||||
<Track.IncreaseRepeatButton>
|
||||
<RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource ScrollBarBaseRepeatButton}"/>
|
||||
</Track.IncreaseRepeatButton>
|
||||
<Track.Thumb>
|
||||
<Thumb Background="{TemplateBinding Foreground}" Style="{StaticResource ScrollBarBaseThumbVertical}"/>
|
||||
</Track.Thumb>
|
||||
</Track>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Orientation" Value="Horizontal">
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
<Setter Property="MinWidth" Value="0"/>
|
||||
<Setter Property="Height" Value="8"/>
|
||||
<Setter Property="MinHeight" Value="8"/>
|
||||
<Setter Property="BorderThickness" Value="0,1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ScrollBar}">
|
||||
<Grid x:Name="Bg" SnapsToDevicePixels="true">
|
||||
<Border Background="{TemplateBinding Background}" />
|
||||
<Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}">
|
||||
<Track.DecreaseRepeatButton>
|
||||
<RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource ScrollBarBaseRepeatButton}"/>
|
||||
</Track.DecreaseRepeatButton>
|
||||
<Track.IncreaseRepeatButton>
|
||||
<RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource ScrollBarBaseRepeatButton}"/>
|
||||
</Track.IncreaseRepeatButton>
|
||||
<Track.Thumb>
|
||||
<Thumb Background="{TemplateBinding Foreground}" Style="{StaticResource ScrollBarBaseThumbHorizontal}"/>
|
||||
</Track.Thumb>
|
||||
</Track>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<ControlTemplate x:Key="ScrollViewerBaseControlTemplate" TargetType="{x:Type ScrollViewer}">
|
||||
<Grid x:Name="Grid" Background="{TemplateBinding Background}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Rectangle x:Name="Corner" Grid.Column="1" StrokeThickness="0" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
|
||||
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
|
||||
<ScrollBar x:Name="PART_VerticalScrollBar" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
|
||||
<ScrollBar x:Name="PART_HorizontalScrollBar" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="ScrollViewerBaseStyle" TargetType="{x:Type ScrollViewer}">
|
||||
<Setter Property="VerticalScrollBarVisibility" Value="Auto"></Setter>
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="Template" Value="{StaticResource ScrollViewerBaseControlTemplate}"></Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,51 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style x:Key="PaginationButtonStyle" TargetType="{x:Type RadioButton}">
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"></Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"></Setter>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"></Setter>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="GroupName" Value="1"></Setter>
|
||||
<Setter Property="Margin" Value="5,0"></Setter>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
|
||||
<Setter Property="RenderTransformOrigin" Value=".5,.5"/>
|
||||
<Setter Property="Background" Value="White"></Setter>
|
||||
<Setter Property="Tag" Value="0"></Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type 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"></TextBlock>
|
||||
</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>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"></Setter>
|
||||
<Setter Property="Foreground" Value="White"></Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value=".2"></Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,11 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/ScrollViewerBaseStyle.xaml"></ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!--默认样式-->
|
||||
<Style BasedOn="{StaticResource ScrollViewerBaseStyle}" TargetType="{x:Type ScrollViewer}"></Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -3,29 +3,32 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Window.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="Button.xaml"></ResourceDictionary>
|
||||
<!--<ResourceDictionary Source="ToggleButton.xaml"></ResourceDictionary>-->
|
||||
<ResourceDictionary Source="TextBlock.xaml"></ResourceDictionary>
|
||||
<!--<ResourceDictionary Source="ToggleButton.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="TextBlock.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="CheckBox.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="RadioButton.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="CheckBox.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="RadioButton.xaml"></ResourceDictionary>-->
|
||||
<ResourceDictionary Source="Border.xaml"></ResourceDictionary>
|
||||
<!--<ResourceDictionary Source="BulletCheckBox.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="Label.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="ProgressBar.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="ScrollViewer.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="BulletCheckBox.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="Label.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="ProgressBar.xaml"></ResourceDictionary>-->
|
||||
<ResourceDictionary Source="ScrollViewer.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="Slider.xaml"></ResourceDictionary>
|
||||
<!--<ResourceDictionary Source="Clock.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="TreeView.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="DataGrid.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="GroupBox.xaml"></ResourceDictionary>
|
||||
<!--<ResourceDictionary Source="Clock.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="TreeView.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="DataGrid.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="GroupBox.xaml"></ResourceDictionary>-->
|
||||
<ResourceDictionary Source="Pagination.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="TabControl.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="ComboBox.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="ContextMenu.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="AnimationPath.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="ToolTip.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="TabControl.xaml"></ResourceDictionary>-->
|
||||
<ResourceDictionary Source="ListBox.xaml"></ResourceDictionary>
|
||||
<!--<ResourceDictionary Source="ComboBox.xaml"></ResourceDictionary>-->
|
||||
<ResourceDictionary Source="Loading.xaml"></ResourceDictionary>
|
||||
<!--<ResourceDictionary Source="ContextMenu.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="AnimationPath.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="ToolTip.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="InfoBrief.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="Expander.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="TextBox.xaml"></ResourceDictionary>-->
|
||||
<!--<ResourceDictionary Source="ContentControl.xaml"></ResourceDictionary>-->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -648,7 +648,7 @@
|
||||
</Grid>
|
||||
</Border>-->
|
||||
<!--页码条-->
|
||||
<!--<Border Visibility="Collapsed" Margin="0,10,0,0" Style="{StaticResource BorderRegionStyle}">
|
||||
<Border Visibility="Collapsed" Margin="0,10,0,0" Style="{StaticResource BorderRegionStyle}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Header"/>
|
||||
@@ -658,9 +658,9 @@
|
||||
<TextBlock Margin="0,5,0,0" Style="{StaticResource TextBlockTitle}" Text="页码条"></TextBlock>
|
||||
<TextBlock Style="{StaticResource TextBlockTitle}" Text="(Pagination)"></TextBlock>
|
||||
</StackPanel>
|
||||
<controls:Pagination Margin="50,0,0,0" MaxPageCount="10" Grid.Column="1"></controls:Pagination>
|
||||
<controls:Pagination HorizontalAlignment="Left" Margin="50,0,0,0" Width="600" MaxPageCount="10" Grid.Column="1"></controls:Pagination>
|
||||
</Grid>
|
||||
</Border>-->
|
||||
</Border>
|
||||
<!--上下文菜单-->
|
||||
<!--<Border Visibility="Collapsed" Margin="0,10,0,0" Style="{StaticResource BorderRegionStyle}">
|
||||
<Grid>
|
||||
|
||||
@@ -12,4 +12,8 @@
|
||||
|
||||
### 3、轮播Carousel
|
||||
|
||||

|
||||

|
||||
|
||||
### 4、页码条Pagination
|
||||
|
||||

|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Reference in new issue
Block a user