From ce94186801e6396ff9048a0097e6a5679ac723a9 Mon Sep 17 00:00:00 2001
From: NaBian <836904362@qq.com>
Date: Thu, 7 May 2020 22:57:54 +0800
Subject: [PATCH] fixed #306
---
.../HandyControl_Net_40.csproj | 4 ++--
.../Controls/PaginationDemoCtl.xaml | 2 +-
.../Controls/Other/Pagination.cs | 18 ++++++++++++++++++
.../Interactivity/Commands/ControlCommands.cs | 5 +++++
.../Properties/Langs/Lang.Designer.cs | 9 +++++++++
.../Properties/Langs/Lang.en.resx | 3 +++
.../Properties/Langs/Lang.fa.resx | 3 +++
.../Properties/Langs/Lang.fr.resx | 3 +++
.../Properties/Langs/Lang.ko-KR.resx | 3 +++
.../Properties/Langs/Lang.resx | 3 +++
.../Properties/Langs/Lang.ru.resx | 3 +++
.../Properties/Langs/Lang.tr.resx | 3 +++
.../Properties/Langs/LangProvider.cs | 11 +++++++++++
.../Themes/Styles/Pagination.xaml | 6 +++++-
14 files changed, 72 insertions(+), 4 deletions(-)
diff --git a/src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj b/src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj
index 5d4fa598..deeacd6e 100644
--- a/src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj
+++ b/src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj
@@ -97,7 +97,7 @@
-
+
Properties\Langs\Lang.tr.resx
@@ -208,4 +208,4 @@
-
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PaginationDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PaginationDemoCtl.xaml
index 1a3eae9a..2bf36b55 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PaginationDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/PaginationDemoCtl.xaml
@@ -12,7 +12,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/Pagination.cs b/src/Shared/HandyControl_Shared/Controls/Other/Pagination.cs
index af9c2485..6241bb0a 100644
--- a/src/Shared/HandyControl_Shared/Controls/Other/Pagination.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Other/Pagination.cs
@@ -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();
diff --git a/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs b/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs
index 770de7f2..6e31c2b2 100644
--- a/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs
+++ b/src/Shared/HandyControl_Shared/Interactivity/Commands/ControlCommands.cs
@@ -107,6 +107,11 @@ namespace HandyControl.Interactivity
///
public static RoutedCommand Next { get; } = new RoutedCommand(nameof(Next), typeof(ControlCommands));
+ ///
+ /// 跳转
+ ///
+ public static RoutedCommand Jump { get; } = new RoutedCommand(nameof(Jump), typeof(ControlCommands));
+
///
/// 上午
///
diff --git a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.Designer.cs
index 88845f2f..dc4e560d 100644
--- a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.Designer.cs
+++ b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.Designer.cs
@@ -249,6 +249,15 @@ namespace HandyControl.Properties.Langs {
}
}
+ ///
+ /// 查找类似 跳转 的本地化字符串。
+ ///
+ public static string Jump {
+ get {
+ return ResourceManager.GetString("Jump", resourceCulture);
+ }
+ }
+
///
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
///
diff --git a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.en.resx
index 2b7c279a..59a34ce7 100644
--- a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.en.resx
+++ b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.en.resx
@@ -231,4 +231,7 @@
Looks up a localized string similar to "{0}".
+
+ Jump
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.fa.resx b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.fa.resx
index afc57df7..91b64abf 100644
--- a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.fa.resx
+++ b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.fa.resx
@@ -231,4 +231,7 @@
Looks up a localized string similar to "{0}".
+
+ Jump
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.fr.resx b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.fr.resx
index df8fb2d0..6b0b722d 100644
--- a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.fr.resx
+++ b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.fr.resx
@@ -231,4 +231,7 @@
Looks up a localized string similar to "{0}".
+
+ Jump
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.ko-KR.resx b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.ko-KR.resx
index 970cbc3f..6a30690f 100644
--- a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.ko-KR.resx
+++ b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.ko-KR.resx
@@ -231,4 +231,7 @@
Looks up a localized string similar to "{0}".
+
+ Jump
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.resx
index 471e5f02..2fc0ff39 100644
--- a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.resx
+++ b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.resx
@@ -231,4 +231,7 @@
查找类似 {0} 的本地化字符串。
+
+ 跳转
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.ru.resx b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.ru.resx
index 6199c570..68e6279b 100644
--- a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.ru.resx
+++ b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.ru.resx
@@ -231,4 +231,7 @@
Ищет локализованную строку, похожую на "{0}".
+
+ Jump
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.tr.resx b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.tr.resx
index 6650e340..0fd8b445 100644
--- a/src/Shared/HandyControl_Shared/Properties/Langs/Lang.tr.resx
+++ b/src/Shared/HandyControl_Shared/Properties/Langs/Lang.tr.resx
@@ -231,4 +231,7 @@
Looks up a localized string similar to "{0}".
+
+ Jump
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Properties/Langs/LangProvider.cs b/src/Shared/HandyControl_Shared/Properties/Langs/LangProvider.cs
index f21f6e82..9f52f043 100644
--- a/src/Shared/HandyControl_Shared/Properties/Langs/LangProvider.cs
+++ b/src/Shared/HandyControl_Shared/Properties/Langs/LangProvider.cs
@@ -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
///
public string IsNecessary => Lang.IsNecessary;
+ ///
+ /// 查找类似 跳转 的本地化字符串。
+ ///
+ public string Jump => Lang.Jump;
+
///
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
///
@@ -381,6 +387,11 @@ namespace HandyControl.Properties.Langs
///
public static string IsNecessary = nameof(IsNecessary);
+ ///
+ /// 查找类似 跳转 的本地化字符串。
+ ///
+ public static string Jump = nameof(Jump);
+
///
/// 查找类似 查找类似 {0} 的本地化字符串。 的本地化字符串。
///
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Pagination.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Pagination.xaml
index 0534ab93..6d6de4d3 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Pagination.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Pagination.xaml
@@ -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">
@@ -95,6 +97,8 @@
+
+