大量更新
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
<!-- 文件路径: /Themes/Generic.xaml -->
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations">
|
||||
|
||||
<!--<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/NeuWPF;component/Controls/ButtonsStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>-->
|
||||
|
||||
<!-- 页码按钮的样式 -->
|
||||
<Style TargetType="Button" x:Key="PaginationButtonStyle">
|
||||
<Style x:Key="EmbossPaginationButtonStyle" TargetType="Button">
|
||||
<Setter Property="MinWidth" Value="32" />
|
||||
<Setter Property="Height" Value="32" />
|
||||
<Setter Property="Margin" Value="2,0" />
|
||||
@@ -26,22 +26,22 @@
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Grid>
|
||||
<decorations:EmbossBorder
|
||||
x:Name="emboss"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Intensity="0.4"
|
||||
x:Name="emboss" />
|
||||
Intensity="0.4" />
|
||||
<decorations:SlotBorder
|
||||
x:Name="slot"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Intensity=".4"
|
||||
Visibility="Collapsed"
|
||||
x:Name="slot" />
|
||||
Visibility="Collapsed" />
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
@@ -53,8 +53,8 @@
|
||||
<Binding Path="CurrentPage" RelativeSource="{RelativeSource AncestorType=controls:Pagination}" />
|
||||
</MultiBinding>
|
||||
</DataTrigger.Binding>
|
||||
<Setter Property="Visibility" TargetName="emboss" Value="Collapsed" />
|
||||
<Setter Property="Visibility" TargetName="slot" Value="Visible" />
|
||||
<Setter TargetName="emboss" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="slot" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -87,13 +87,78 @@
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="PaginationButtonStyle" TargetType="Button">
|
||||
<Setter Property="MinWidth" Value="34" />
|
||||
<Setter Property="MinHeight" Value="34" />
|
||||
<Setter Property="Margin" Value="2,0" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Grid>
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4" />
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<!-- 核心: 当按钮的值等于控件的当前页时,改变样式 -->
|
||||
<DataTrigger Value="True">
|
||||
<DataTrigger.Binding>
|
||||
<MultiBinding Converter="{x:Static converters:ComparisionConverter.Instance}">
|
||||
<!-- 来自按钮的 DataContext (PageItem.Value) -->
|
||||
<Binding Path="Value" />
|
||||
<Binding Path="CurrentPage" RelativeSource="{RelativeSource AncestorType=controls:Pagination}" />
|
||||
</MultiBinding>
|
||||
</DataTrigger.Binding>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
|
||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Value="True">
|
||||
<DataTrigger.Binding>
|
||||
<MultiBinding Converter="{x:Static converters:ComparisionConverter.Instance}">
|
||||
<Binding Path="Value" />
|
||||
<Binding Path="CurrentPage" RelativeSource="{RelativeSource AncestorType=controls:Pagination}" />
|
||||
</MultiBinding>
|
||||
</DataTrigger.Binding>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
||||
</DataTrigger>
|
||||
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.6" />
|
||||
<Setter Property="Cursor" Value="No" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- PaginationControl 的主模板 -->
|
||||
<Style TargetType="{x:Type controls:Pagination}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:Pagination}">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<!-- 页码按钮列表 -->
|
||||
<ItemsControl ItemsSource="{Binding PageItems, RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
@@ -114,11 +179,10 @@
|
||||
|
||||
<!-- 页面尺寸选择器 -->
|
||||
<ComboBox
|
||||
Height="32"
|
||||
ItemsSource="{Binding PageSizeOptions, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="8,0,0,0"
|
||||
SelectedItem="{Binding PageSize, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||||
VerticalContentAlignment="Center">
|
||||
VerticalContentAlignment="Center"
|
||||
ItemsSource="{Binding PageSizeOptions, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
SelectedItem="{Binding PageSize, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding StringFormat={}{0} 条/页}" />
|
||||
@@ -129,18 +193,18 @@
|
||||
<!-- 跳转输入框 -->
|
||||
<StackPanel
|
||||
Margin="8,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{Binding ShowPageInput, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}">
|
||||
<TextBlock Text="跳至" VerticalAlignment="Center" />
|
||||
<TextBlock VerticalAlignment="Center" Text="跳至" />
|
||||
<TextBox
|
||||
HorizontalContentAlignment="Center"
|
||||
Margin="4,0"
|
||||
Text="{Binding CurrentPage, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
|
||||
VerticalContentAlignment="Center"
|
||||
x:Name="PART_PageInputTextBox"
|
||||
Width="50"
|
||||
x:Name="PART_PageInputTextBox" />
|
||||
<TextBlock Text="页" VerticalAlignment="Center" />
|
||||
Margin="4,0"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Text="{Binding CurrentPage, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="页" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
|
||||
Reference in New Issue
Block a user