From 912a10b56de0f17f41ae86ca0743c601f0d4ce76 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Sat, 29 Dec 2018 13:33:33 +0800 Subject: [PATCH] ready for coverview --- HandyControl/Controls/CoverView/CoverView.cs | 9 +++++++++ .../Controls/CoverView/CoverViewItem.cs | 9 +++++++++ HandyControl/Controls/Other/ScrollViewer.cs | 15 +++++++++++++-- HandyControl/HandyControl.csproj | 10 ++++++++++ .../Themes/Styles/Base/CoverViewBaseStyle.xaml | 13 +++++++++++++ HandyControl/Themes/Styles/CoverView.xaml | 4 ++++ HandyControl/Themes/Styles/Style.xaml | 1 + HandyControlDemo/Data/MessageToken.cs | 2 ++ HandyControlDemo/Data/MessageToken.tt | 3 ++- HandyControlDemo/HandyControlDemo.csproj | 8 ++++++++ .../Properties/Langs/Lang.Designer.cs | 11 ++++++++++- HandyControlDemo/Properties/Langs/Lang.en.resx | 3 +++ HandyControlDemo/Properties/Langs/Lang.resx | 3 +++ .../Img/LeftMainContent/DetailDataView_16x.png | Bin 0 -> 129 bytes .../UserControl/Controls/CoverViewDemoCtl.xaml | 13 +++++++++++++ .../Controls/CoverViewDemoCtl.xaml.cs | 10 ++++++++++ .../Controls/WaterfallPanelDemoCtl.xaml | 16 +++------------- .../UserControl/Main/LeftMainContent.xaml | 5 +++++ 18 files changed, 118 insertions(+), 17 deletions(-) create mode 100644 HandyControl/Controls/CoverView/CoverView.cs create mode 100644 HandyControl/Controls/CoverView/CoverViewItem.cs create mode 100644 HandyControl/Themes/Styles/Base/CoverViewBaseStyle.xaml create mode 100644 HandyControl/Themes/Styles/CoverView.xaml create mode 100644 HandyControlDemo/Resources/Img/LeftMainContent/DetailDataView_16x.png create mode 100644 HandyControlDemo/UserControl/Controls/CoverViewDemoCtl.xaml create mode 100644 HandyControlDemo/UserControl/Controls/CoverViewDemoCtl.xaml.cs diff --git a/HandyControl/Controls/CoverView/CoverView.cs b/HandyControl/Controls/CoverView/CoverView.cs new file mode 100644 index 00000000..72d529b4 --- /dev/null +++ b/HandyControl/Controls/CoverView/CoverView.cs @@ -0,0 +1,9 @@ +using System.Windows.Controls; + +namespace HandyControl.Controls +{ + public class CoverView : ItemsControl + { + + } +} \ No newline at end of file diff --git a/HandyControl/Controls/CoverView/CoverViewItem.cs b/HandyControl/Controls/CoverView/CoverViewItem.cs new file mode 100644 index 00000000..ee9cc718 --- /dev/null +++ b/HandyControl/Controls/CoverView/CoverViewItem.cs @@ -0,0 +1,9 @@ +using System.Windows.Controls; + +namespace HandyControl.Controls +{ + public class CoverViewItem : HeaderedContentControl + { + + } +} \ No newline at end of file diff --git a/HandyControl/Controls/Other/ScrollViewer.cs b/HandyControl/Controls/Other/ScrollViewer.cs index a2fdaccd..823e66fc 100644 --- a/HandyControl/Controls/Other/ScrollViewer.cs +++ b/HandyControl/Controls/Other/ScrollViewer.cs @@ -49,14 +49,25 @@ namespace HandyControl.Controls protected override void OnMouseWheel(MouseWheelEventArgs e) { + if (!CanMouseWheel) return; + if (!IsEnableInertia) { - base.OnMouseWheel(e); + if (Orientation == Orientation.Vertical) + { + base.OnMouseWheel(e); + } + else + { + _totalHorizontalOffset = HorizontalOffset; + CurrentHorizontalOffset = HorizontalOffset; + _totalHorizontalOffset = Math.Min(Math.Max(0, _totalHorizontalOffset - e.Delta), ScrollableWidth); + CurrentHorizontalOffset = _totalHorizontalOffset; + } return; } e.Handled = true; - if (!CanMouseWheel) return; if (Orientation == Orientation.Vertical) { if (!_isRunning) diff --git a/HandyControl/HandyControl.csproj b/HandyControl/HandyControl.csproj index 193d91ea..ee5de855 100644 --- a/HandyControl/HandyControl.csproj +++ b/HandyControl/HandyControl.csproj @@ -117,6 +117,7 @@ + @@ -131,6 +132,7 @@ + @@ -375,6 +377,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -407,6 +413,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/HandyControl/Themes/Styles/Base/CoverViewBaseStyle.xaml b/HandyControl/Themes/Styles/Base/CoverViewBaseStyle.xaml new file mode 100644 index 00000000..3e872520 --- /dev/null +++ b/HandyControl/Themes/Styles/Base/CoverViewBaseStyle.xaml @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/HandyControl/Themes/Styles/CoverView.xaml b/HandyControl/Themes/Styles/CoverView.xaml new file mode 100644 index 00000000..825650eb --- /dev/null +++ b/HandyControl/Themes/Styles/CoverView.xaml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/HandyControl/Themes/Styles/Style.xaml b/HandyControl/Themes/Styles/Style.xaml index 19959398..a460151f 100644 --- a/HandyControl/Themes/Styles/Style.xaml +++ b/HandyControl/Themes/Styles/Style.xaml @@ -50,6 +50,7 @@ + \ No newline at end of file diff --git a/HandyControlDemo/Data/MessageToken.cs b/HandyControlDemo/Data/MessageToken.cs index 51a59bfe..927788fb 100644 --- a/HandyControlDemo/Data/MessageToken.cs +++ b/HandyControlDemo/Data/MessageToken.cs @@ -70,6 +70,8 @@ public static readonly string WaterfallPanelDemoCtl = nameof(WaterfallPanelDemoCtl); + public static readonly string CoverViewDemoCtl = nameof(CoverViewDemoCtl); + public static readonly string ButtonDemoCtl = nameof(ButtonDemoCtl); public static readonly string ToggleButtonDemoCtl = nameof(ToggleButtonDemoCtl); diff --git a/HandyControlDemo/Data/MessageToken.tt b/HandyControlDemo/Data/MessageToken.tt index 5ea16e51..ffe9e0de 100644 --- a/HandyControlDemo/Data/MessageToken.tt +++ b/HandyControlDemo/Data/MessageToken.tt @@ -37,7 +37,8 @@ var controlList = new List "BlurWindow", "RateDemoCtl", "ShieldDemoCtl", - "WaterfallPanelDemoCtl" + "WaterfallPanelDemoCtl", + "CoverViewDemoCtl" }; var styleList = new List { diff --git a/HandyControlDemo/HandyControlDemo.csproj b/HandyControlDemo/HandyControlDemo.csproj index 16ec2be7..21f1785f 100644 --- a/HandyControlDemo/HandyControlDemo.csproj +++ b/HandyControlDemo/HandyControlDemo.csproj @@ -139,6 +139,9 @@ CompareSliderDemoCtl.xaml + + CoverViewDemoCtl.xaml + DatePickerDemoCtl.xaml @@ -418,6 +421,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -678,6 +685,7 @@ TextTemplatingFileGenerator MessageToken.cs + diff --git a/HandyControlDemo/Properties/Langs/Lang.Designer.cs b/HandyControlDemo/Properties/Langs/Lang.Designer.cs index 643b06b1..6e2798e8 100644 --- a/HandyControlDemo/Properties/Langs/Lang.Designer.cs +++ b/HandyControlDemo/Properties/Langs/Lang.Designer.cs @@ -47,7 +47,7 @@ namespace HandyControlDemo.Properties.Langs { } /// - /// 使用此强类型资源类,为所有资源查找 + /// 重写当前线程的 CurrentUICulture 属性 /// 重写当前线程的 CurrentUICulture 属性。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] @@ -303,6 +303,15 @@ namespace HandyControlDemo.Properties.Langs { } } + /// + /// 查找类似 封面视图 的本地化字符串。 + /// + public static string CoverView { + get { + return ResourceManager.GetString("CoverView", resourceCulture); + } + } + /// /// 查找类似 危险 的本地化字符串。 /// diff --git a/HandyControlDemo/Properties/Langs/Lang.en.resx b/HandyControlDemo/Properties/Langs/Lang.en.resx index faf3af75..a99298ea 100644 --- a/HandyControlDemo/Properties/Langs/Lang.en.resx +++ b/HandyControlDemo/Properties/Langs/Lang.en.resx @@ -456,4 +456,7 @@ Groups + + CoverView + \ No newline at end of file diff --git a/HandyControlDemo/Properties/Langs/Lang.resx b/HandyControlDemo/Properties/Langs/Lang.resx index 0bfff05e..ef6c99fb 100644 --- a/HandyControlDemo/Properties/Langs/Lang.resx +++ b/HandyControlDemo/Properties/Langs/Lang.resx @@ -436,4 +436,7 @@ 组数 + + 封面视图 + \ No newline at end of file diff --git a/HandyControlDemo/Resources/Img/LeftMainContent/DetailDataView_16x.png b/HandyControlDemo/Resources/Img/LeftMainContent/DetailDataView_16x.png new file mode 100644 index 0000000000000000000000000000000000000000..64f2bcd000544d559cd1c4faaaa3c55f5d6d8ab1 GIT binary patch literal 129 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5he4R}c>anMprEm* zi(^Pd+}jBoIT;*yn2cxtKA${WJ)S*CC1G(wX~BYp{3q{x;bz#PYxZI9gS0055A2_8 Yta}3fe{JQQ4b;xy>FVdQ&MBb@09ZvRivR!s literal 0 HcmV?d00001 diff --git a/HandyControlDemo/UserControl/Controls/CoverViewDemoCtl.xaml b/HandyControlDemo/UserControl/Controls/CoverViewDemoCtl.xaml new file mode 100644 index 00000000..d2302a54 --- /dev/null +++ b/HandyControlDemo/UserControl/Controls/CoverViewDemoCtl.xaml @@ -0,0 +1,13 @@ + + + + +