This commit is contained in:
NaBian committed 2020-05-07 22:57:54 +08:00
1 parent 518afc8845
commit ce94186801
14 files changed
+72 -4

No files matched your search

@@ -97,7 +97,7 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\..\Shared\HandyControl_Shared\Properties\Langs\Lang.tr.resx">
<EmbeddedResource Include="..\..\Shared\HandyControl_Shared\Properties\Langs\Lang.tr.resx">
<Link>Properties\Langs\Lang.tr.resx</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\..\Shared\HandyControl_Shared\Properties\Langs\Lang.en.resx">
@@ -208,4 +208,4 @@
<Page Remove="..\..\Shared\HandyControl_Shared\Themes\Styles\MessageBox.xaml" />
<Page Remove="..\..\Shared\HandyControl_Shared\Themes\Styles\Window.xaml" />
</ItemGroup>
</Project>
</Project>
@@ -12,7 +12,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<hc:Pagination MaxPageCount="10" PageIndex="{Binding PageIndex}">
<hc:Pagination MaxPageCount="10" PageIndex="{Binding PageIndex}" IsJumpEnabled="True">
<hc:Interaction.Triggers>
<hc:EventTrigger EventName="PageUpdated">
<hc:EventToCommand Command="{Binding PageUpdatedCmd}" PassEventArgsToCommand="True" />
@@ -19,6 +19,7 @@ namespace HandyControl.Controls
[TemplatePart(Name = ElementPanelMain, Type = typeof(Panel))]
[TemplatePart(Name = ElementMoreRight, Type = typeof(FrameworkElement))]
[TemplatePart(Name = ElementButtonLast, Type = typeof(RadioButton))]
[TemplatePart(Name = ElementButtonLast, Type = typeof(NumericUpDown))]
public class Pagination : Control
{
#region Constants
@@ -30,6 +31,7 @@ namespace HandyControl.Controls
private const string ElementPanelMain = "PART_PanelMain";
private const string ElementMoreRight = "PART_MoreRight";
private const string ElementButtonLast = "PART_ButtonLast";
private const string ElementJump = "PART_Jump";
#endregion Constants
@@ -42,6 +44,7 @@ namespace HandyControl.Controls
private Panel _panelMain;
private FrameworkElement _moreRight;
private RadioButton _buttonLast;
private NumericUpDown _jumpNumericUpDown;
private bool _appliedTemplate;
@@ -72,6 +75,7 @@ namespace HandyControl.Controls
CommandBindings.Add(new CommandBinding(ControlCommands.Prev, ButtonPrev_OnClick));
CommandBindings.Add(new CommandBinding(ControlCommands.Next, ButtonNext_OnClick));
CommandBindings.Add(new CommandBinding(ControlCommands.Selected, ToggleButton_OnChecked));
CommandBindings.Add(new CommandBinding(ControlCommands.Jump, (s, e) => PageIndex = (int) _jumpNumericUpDown.Value));
this.Show(MaxPageCount > 1);
}
@@ -219,6 +223,19 @@ namespace HandyControl.Controls
#endregion MaxPageInterval
#region IsJumpEnabled
public static readonly DependencyProperty IsJumpEnabledProperty = DependencyProperty.Register(
"IsJumpEnabled", typeof(bool), typeof(Pagination), new PropertyMetadata(ValueBoxes.FalseBox));
public bool IsJumpEnabled
{
get => (bool) GetValue(IsJumpEnabledProperty);
set => SetValue(IsJumpEnabledProperty, value);
}
#endregion
#endregion
#region Public Methods
@@ -235,6 +252,7 @@ namespace HandyControl.Controls
_panelMain = GetTemplateChild(ElementPanelMain) as Panel;
_moreRight = GetTemplateChild(ElementMoreRight) as FrameworkElement;
_buttonLast = GetTemplateChild(ElementButtonLast) as RadioButton;
_jumpNumericUpDown = GetTemplateChild(ElementJump) as NumericUpDown;
CheckNull();
@@ -107,6 +107,11 @@ namespace HandyControl.Interactivity
/// </summary>
public static RoutedCommand Next { get; } = new RoutedCommand(nameof(Next), typeof(ControlCommands));
/// <summary>
/// 跳转
/// </summary>
public static RoutedCommand Jump { get; } = new RoutedCommand(nameof(Jump), typeof(ControlCommands));
/// <summary>
/// 上午
/// </summary>
@@ -249,6 +249,15 @@ namespace HandyControl.Properties.Langs {
}
}
/// <summary>
/// 查找类似 跳转 的本地化字符串。
/// </summary>
public static string Jump {
get {
return ResourceManager.GetString("Jump", resourceCulture);
}
}
/// <summary>
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
/// </summary>
@@ -231,4 +231,7 @@
<data name="LangComment" xml:space="preserve">
<value>Looks up a localized string similar to "{0}".</value>
</data>
<data name="Jump" xml:space="preserve">
<value>Jump</value>
</data>
</root>
@@ -231,4 +231,7 @@
<data name="LangComment" xml:space="preserve">
<value>Looks up a localized string similar to "{0}".</value>
</data>
<data name="Jump" xml:space="preserve">
<value>Jump</value>
</data>
</root>
@@ -231,4 +231,7 @@
<data name="LangComment" xml:space="preserve">
<value>Looks up a localized string similar to "{0}".</value>
</data>
<data name="Jump" xml:space="preserve">
<value>Jump</value>
</data>
</root>
@@ -231,4 +231,7 @@
<data name="LangComment" xml:space="preserve">
<value>Looks up a localized string similar to "{0}".</value>
</data>
<data name="Jump" xml:space="preserve">
<value>Jump</value>
</data>
</root>
@@ -231,4 +231,7 @@
<data name="LangComment" xml:space="preserve">
<value>查找类似 {0} 的本地化字符串。</value>
</data>
<data name="Jump" xml:space="preserve">
<value>跳转</value>
</data>
</root>
@@ -231,4 +231,7 @@
<data name="LangComment" xml:space="preserve">
<value>Ищет локализованную строку, похожую на "{0}".</value>
</data>
<data name="Jump" xml:space="preserve">
<value>Jump</value>
</data>
</root>
@@ -231,4 +231,7 @@
<data name="LangComment" xml:space="preserve">
<value>Looks up a localized string similar to "{0}".</value>
</data>
<data name="Jump" xml:space="preserve">
<value>Jump</value>
</data>
</root>
@@ -58,6 +58,7 @@ namespace HandyControl.Properties.Langs
OnPropertyChanged(nameof(Interval30s));
OnPropertyChanged(nameof(Interval5m));
OnPropertyChanged(nameof(IsNecessary));
OnPropertyChanged(nameof(Jump));
OnPropertyChanged(nameof(LangComment));
OnPropertyChanged(nameof(NextPage));
OnPropertyChanged(nameof(No));
@@ -182,6 +183,11 @@ namespace HandyControl.Properties.Langs
/// </summary>
public string IsNecessary => Lang.IsNecessary;
/// <summary>
/// 查找类似 跳转 的本地化字符串。
/// </summary>
public string Jump => Lang.Jump;
/// <summary>
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
/// </summary>
@@ -381,6 +387,11 @@ namespace HandyControl.Properties.Langs
/// </summary>
public static string IsNecessary = nameof(IsNecessary);
/// <summary>
/// 查找类似 跳转 的本地化字符串。
/// </summary>
public static string Jump = nameof(Jump);
/// <summary>
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
/// </summary>
@@ -2,7 +2,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls"
xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
xmlns:system="clr-namespace:System;assembly=mscorlib">
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:lang="clr-namespace:HandyControl.Properties.Langs"
xmlns:ex="clr-namespace:HandyControl.Tools.Extension">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Basic/Geometries.xaml"/>
@@ -95,6 +97,8 @@
<RadioButton Name="PART_ButtonLast" Content="10" Style="{StaticResource PaginationButtonStyle}"/>
</StackPanel>
<Button x:Name="PART_ButtonRight" MinWidth="30" Padding="10,8" controls:IconElement.Geometry="{StaticResource RightGeometry}" controls:BorderElement.CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource CornerRadiusSplitConverter},ConverterParameter='0,1,1,0'}" Margin="-1,0,0,0" Command="interactivity:ControlCommands.Next"/>
<controls:NumericUpDown x:Name="PART_Jump" IsEnabled="{TemplateBinding IsJumpEnabled}" Visibility="{TemplateBinding IsJumpEnabled,Converter={StaticResource Boolean2VisibilityConverter}}" Margin="6,0,0,0" Maximum="{Binding MaxPageCount,RelativeSource={RelativeSource TemplatedParent}}" Minimum="1"/>
<Button IsEnabled="{TemplateBinding IsJumpEnabled}" Visibility="{TemplateBinding IsJumpEnabled,Converter={StaticResource Boolean2VisibilityConverter}}" Content="{ex:Lang {x:Static lang:LangKeys.Jump}}" Margin="6,0,0,0" Command="interactivity:ControlCommands.Jump"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>