From fa863c5bcba326f8e1d636b942fbbbac6ab44d02 Mon Sep 17 00:00:00 2001
From: NaBian <836904362@qq.com>
Date: Thu, 24 Oct 2019 21:58:34 +0800
Subject: [PATCH 1/3] init branch
---
.../HandyControlDemo_Core30.csproj | 10 +++--
.../HandyControl_Core_30.csproj | 5 ++-
.../HandyControlDemo_Net_40.csproj | 3 ++
.../HandyControlDemo_Net_GE45.csproj | 3 ++
.../Data/MessageToken.cs | 2 +
.../Data/MessageToken.tt | 3 +-
.../HandyControlDemo_Shared.projitems | 7 ++++
.../HandyControlDemo_Shared/MainWindow.xaml | 26 +++++++------
.../Properties/AssemblyInfo.cs | 2 +-
.../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.resx | 3 ++
.../LeftMainContent/DottedSplitter_16x.png | Bin 0 -> 125 bytes
.../UserControl/Controls/DividerDemoCtl.xaml | 8 ++++
.../Controls/DividerDemoCtl.xaml.cs | 10 +++++
.../UserControl/Main/LeftMainContent.xaml | 7 +++-
.../Controls/Other/Divider.cs | 36 ++++++++++++++++++
.../HandyControl_Shared.projitems | 9 +++++
.../Properties/AssemblyInfo.cs | 2 +-
.../Themes/Styles/Base/DividerBaseStyle.xaml | 9 +++++
.../Themes/Styles/Divider.xaml | 10 +++++
.../Themes/Styles/Style.xaml | 1 +
24 files changed, 153 insertions(+), 21 deletions(-)
create mode 100644 src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/DottedSplitter_16x.png
create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml
create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml.cs
create mode 100644 src/Shared/HandyControl_Shared/Controls/Other/Divider.cs
create mode 100644 src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
create mode 100644 src/Shared/HandyControl_Shared/Themes/Styles/Divider.xaml
diff --git a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
index d785a5c1..1b7528d8 100644
--- a/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
+++ b/src/Core_30/HandyControlDemo_Core_30/HandyControlDemo_Core30.csproj
@@ -5,13 +5,14 @@
true
HandyControlDemo
HandyControlDemo
- 2.2.0
+ 2.3.0
..\..\Shared\HandyControlDemo_Shared\Resources\Img\icon.ico
Debug;Release
Copyright © HandyOrg 2018-2019
- 2.2.0.0
- 2.2.0.0
+ 2.3.0.0
+ 2.3.0.0
8.0
+ HandyOrg
TRACE;Core
@@ -426,6 +427,9 @@
Resources\Img\LeftMainContent\DataGenerator_16x.png
+
+ Resources\Img\LeftMainContent\DottedSplitter_16x.png
+
diff --git a/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj b/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj
index cbf01071..19e745b0 100644
--- a/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj
+++ b/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj
@@ -4,14 +4,15 @@
true
HandyControl
HandyControl
- 2.2.0
- 2.2.0.0
+ 2.3.0
+ 2.3.0.0
false
false
Copyright © HandyOrg 2018-2019
Contains some commonly used simple WPF controls
Debug;Release
8.0
+ HandyOrg
TRACE;Core
diff --git a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
index af34f24b..6ea01470 100644
--- a/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
+++ b/src/Net_40/HandyControlDemo_Net_40/HandyControlDemo_Net_40.csproj
@@ -427,6 +427,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\DottedSplitter_16x.png
+
Resources\Img\qq_group_1.jpg
diff --git a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
index c58b88a3..d7566d1b 100644
--- a/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
+++ b/src/Net_GE45/HandyControlDemo_Net_GE45/HandyControlDemo_Net_GE45.csproj
@@ -496,6 +496,9 @@
TextTemplatingFileGenerator
MessageToken.cs
+
+ Resources\Img\LeftMainContent\DottedSplitter_16x.png
+
Resources\Img\qq_group_1.jpg
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
index 717a71ac..c59c99a0 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.cs
@@ -120,6 +120,8 @@
public static readonly string SplitButtonDemoCtl = nameof(SplitButtonDemoCtl);
+ public static readonly string DividerDemoCtl = nameof(DividerDemoCtl);
+
/*-------------------- Tools --------------------*/
public static readonly string HatchBrushGeneratorDemoCtl = nameof(HatchBrushGeneratorDemoCtl);
diff --git a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
index 91d84fbb..201cc75c 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
+++ b/src/Shared/HandyControlDemo_Shared/Data/MessageToken.tt
@@ -61,7 +61,8 @@ var controlList = new List
"SpriteDemoCtl",
"NotificationDemoCtl",
"FloatingBlockDemoCtl",
- "SplitButtonDemoCtl"
+ "SplitButtonDemoCtl",
+ "DividerDemoCtl"
};
var styleList = new List
{
diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
index b13bd738..53ef32fc 100644
--- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
+++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
@@ -55,6 +55,9 @@
CardDemoCtl.xaml
+
+ DividerDemoCtl.xaml
+
FloatingBlockDemoCtl.xaml
@@ -460,6 +463,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControlDemo_Shared/MainWindow.xaml b/src/Shared/HandyControlDemo_Shared/MainWindow.xaml
index 9ff31060..867219d7 100644
--- a/src/Shared/HandyControlDemo_Shared/MainWindow.xaml
+++ b/src/Shared/HandyControlDemo_Shared/MainWindow.xaml
@@ -26,16 +26,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/AssemblyInfo.cs b/src/Shared/HandyControlDemo_Shared/Properties/AssemblyInfo.cs
index da33491c..e87a0781 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/AssemblyInfo.cs
+++ b/src/Shared/HandyControlDemo_Shared/Properties/AssemblyInfo.cs
@@ -13,5 +13,5 @@ using System.Windows;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
-[assembly: AssemblyVersion("2.2.0")]
+[assembly: AssemblyVersion("2.3.0")]
#endif
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
index b26bcdf7..e2cf3fe6 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.Designer.cs
@@ -492,6 +492,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 分割线 的本地化字符串。
+ ///
+ public static string Divider {
+ get {
+ return ResourceManager.GetString("Divider", resourceCulture);
+ }
+ }
+
///
/// 查找类似 在这里拖拽 的本地化字符串。
///
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
index efa53531..f555d91f 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.en.resx
@@ -675,4 +675,7 @@
Morphing Animation
+
+ Divider
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
index 3ee98c1b..170b2ced 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fa.resx
@@ -675,4 +675,7 @@
Morphing Animation
+
+ Divider
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
index 6c7214be..f7c5365c 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.fr.resx
@@ -675,4 +675,7 @@
Morphing Animation
+
+ Divider
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
index 3950a730..2d26de95 100644
--- a/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
+++ b/src/Shared/HandyControlDemo_Shared/Properties/Langs/Lang.resx
@@ -675,4 +675,7 @@
变形动画
+
+ 分割线
+
\ No newline at end of file
diff --git a/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/DottedSplitter_16x.png b/src/Shared/HandyControlDemo_Shared/Resources/Img/LeftMainContent/DottedSplitter_16x.png
new file mode 100644
index 0000000000000000000000000000000000000000..14b2af988d23ec476fc2572fe74398a237dd3dfa
GIT binary patch
literal 125
zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5he4R}c>anMprF2|
zi(^Pd+}r+*oD2*chxe@gfB$mm!KQ
V*Z1OP3xHY~JYD@<);T3K0RU5XDeeFO
literal 0
HcmV?d00001
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml
new file mode 100644
index 00000000..ac5613e2
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml.cs
new file mode 100644
index 00000000..7cd8f16f
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class DividerDemoCtl
+ {
+ public DividerDemoCtl()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
index a3bd5714..2081856c 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Main/LeftMainContent.xaml
@@ -345,6 +345,11 @@
+
+
+
+
+
@@ -455,7 +460,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/Divider.cs b/src/Shared/HandyControl_Shared/Controls/Other/Divider.cs
new file mode 100644
index 00000000..87ab5736
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Controls/Other/Divider.cs
@@ -0,0 +1,36 @@
+using System.Windows;
+using System.Windows.Controls;
+using HandyControl.Data;
+
+namespace HandyControl.Controls
+{
+ public class Divider : Control
+ {
+ public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
+ "Content", typeof(object), typeof(Divider), new PropertyMetadata(default(object)));
+
+ public object Content
+ {
+ get => (object) GetValue(ContentProperty);
+ set => SetValue(ContentProperty, value);
+ }
+
+ public static readonly DependencyProperty DashedProperty = DependencyProperty.Register(
+ "Dashed", typeof(bool), typeof(Divider), new PropertyMetadata(ValueBoxes.FalseBox));
+
+ public bool Dashed
+ {
+ get => (bool) GetValue(DashedProperty);
+ set => SetValue(DashedProperty, value);
+ }
+
+ public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
+ "Orientation", typeof(Orientation), typeof(Divider), new PropertyMetadata(default(Orientation)));
+
+ public Orientation Orientation
+ {
+ get => (Orientation) GetValue(OrientationProperty);
+ set => SetValue(OrientationProperty, value);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index 96093d43..0eb2b080 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -24,6 +24,7 @@
+
@@ -381,6 +382,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -425,6 +430,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControl_Shared/Properties/AssemblyInfo.cs b/src/Shared/HandyControl_Shared/Properties/AssemblyInfo.cs
index 3e1281fb..15e58489 100644
--- a/src/Shared/HandyControl_Shared/Properties/AssemblyInfo.cs
+++ b/src/Shared/HandyControl_Shared/Properties/AssemblyInfo.cs
@@ -12,7 +12,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
-[assembly: AssemblyVersion("2.2.0")]
+[assembly: AssemblyVersion("2.3.0")]
#endif
[assembly: XmlnsDefinition("https://handyorg.github.io/handycontrol", "HandyControl.Controls")]
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
new file mode 100644
index 00000000..cb3723f0
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Divider.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Divider.xaml
new file mode 100644
index 00000000..aee6e531
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Divider.xaml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
index 46347ec2..ea4bb002 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Style.xaml
@@ -75,6 +75,7 @@
+
\ No newline at end of file
From 48920792f0eb03b88f713eb5ff30dcd6bbbffc39 Mon Sep 17 00:00:00 2001
From: NaBian <836904362@qq.com>
Date: Fri, 25 Oct 2019 01:13:16 +0800
Subject: [PATCH 2/3] add some demos
---
.../UserControl/Controls/DividerDemoCtl.xaml | 13 +++-
.../HandyControl_Shared/Controls/Grid/Col.cs | 7 +-
.../HandyControl_Shared/Controls/Grid/Row.cs | 20 +++---
.../Controls/Other/Divider.cs | 66 ++++++++++++++++---
.../Data/Enum/ColLayoutStatus.cs | 1 +
.../Themes/Styles/Base/DividerBaseStyle.xaml | 26 ++++++++
.../Tools/Extension/ColLayout.cs | 2 +
7 files changed, 113 insertions(+), 22 deletions(-)
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml
index ac5613e2..5c273b76 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml
@@ -1,8 +1,15 @@
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Controls/Grid/Col.cs b/src/Shared/HandyControl_Shared/Controls/Grid/Col.cs
index 1a77bc96..62c8f908 100644
--- a/src/Shared/HandyControl_Shared/Controls/Grid/Col.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Grid/Col.cs
@@ -1,4 +1,5 @@
-using System.Windows;
+using System;
+using System.Windows;
using System.Windows.Controls;
using HandyControl.Data;
using HandyControl.Tools.Extension;
@@ -66,6 +67,10 @@ namespace HandyControl.Controls
case ColLayoutStatus.Xxl:
result = Layout.Xxl;
break;
+ case ColLayoutStatus.Auto:
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(status), status, null);
}
}
else
diff --git a/src/Shared/HandyControl_Shared/Controls/Grid/Row.cs b/src/Shared/HandyControl_Shared/Controls/Grid/Row.cs
index e659178d..36670f02 100644
--- a/src/Shared/HandyControl_Shared/Controls/Grid/Row.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Grid/Row.cs
@@ -13,6 +13,8 @@ namespace HandyControl.Controls
private double _maxChildDesiredHeight;
+ private double _totalAutoWidth;
+
public static readonly DependencyProperty GutterProperty = DependencyProperty.Register(
"Gutter", typeof(double), typeof(Row), new PropertyMetadata(ValueBoxes.Double0Box, null, OnGutterCoerce), ValidateHelper.IsInRangeOfPosDoubleIncludeZero);
@@ -29,6 +31,7 @@ namespace HandyControl.Controls
var totalCellCount = 0;
var totalRowCount = 1;
var gutterHalf = Gutter / 2;
+ _totalAutoWidth = 0;
foreach (var child in InternalChildren.OfType())
{
@@ -40,12 +43,7 @@ namespace HandyControl.Controls
{
_maxChildDesiredHeight = childDesiredSize.Height;
}
- }
- _layoutStatus = ColLayout.GetLayoutStatus(constraint.Width);
-
- foreach (var child in InternalChildren.OfType())
- {
var cellCount = child.GetLayoutCellCount(_layoutStatus);
totalCellCount += cellCount;
@@ -54,16 +52,21 @@ namespace HandyControl.Controls
totalCellCount = cellCount;
totalRowCount++;
}
+
+ if (cellCount == 0)
+ {
+ _totalAutoWidth += childDesiredSize.Width;
+ }
}
- return new Size(0, _maxChildDesiredHeight * totalRowCount - Gutter);
+ return new Size(constraint.Width, _maxChildDesiredHeight * totalRowCount - Gutter);
}
protected override Size ArrangeOverride(Size finalSize)
{
var totalCellCount = 0;
var gutterHalf = Gutter / 2;
- var itemWidth = (finalSize.Width + Gutter) / ColLayout.ColMaxCellCount;
+ var itemWidth = (finalSize.Width - _totalAutoWidth + Gutter) / ColLayout.ColMaxCellCount;
var childBounds = new Rect(-gutterHalf, -gutterHalf, 0, _maxChildDesiredHeight);
_layoutStatus = ColLayout.GetLayoutStatus(finalSize.Width);
@@ -72,7 +75,8 @@ namespace HandyControl.Controls
var cellCount = child.GetLayoutCellCount(_layoutStatus);
totalCellCount += cellCount;
- var childWidth = cellCount * itemWidth;
+ var childWidth = cellCount > 0 ? cellCount * itemWidth : child.DesiredSize.Width;
+
childBounds.Width = childWidth;
childBounds.X += child.Offset * itemWidth;
if (totalCellCount > ColLayout.ColMaxCellCount)
diff --git a/src/Shared/HandyControl_Shared/Controls/Other/Divider.cs b/src/Shared/HandyControl_Shared/Controls/Other/Divider.cs
index 87ab5736..5d15f7d1 100644
--- a/src/Shared/HandyControl_Shared/Controls/Other/Divider.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Other/Divider.cs
@@ -1,5 +1,6 @@
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Media;
using HandyControl.Data;
namespace HandyControl.Controls
@@ -11,19 +12,10 @@ namespace HandyControl.Controls
public object Content
{
- get => (object) GetValue(ContentProperty);
+ get => GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}
- public static readonly DependencyProperty DashedProperty = DependencyProperty.Register(
- "Dashed", typeof(bool), typeof(Divider), new PropertyMetadata(ValueBoxes.FalseBox));
-
- public bool Dashed
- {
- get => (bool) GetValue(DashedProperty);
- set => SetValue(DashedProperty, value);
- }
-
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
"Orientation", typeof(Orientation), typeof(Divider), new PropertyMetadata(default(Orientation)));
@@ -32,5 +24,59 @@ namespace HandyControl.Controls
get => (Orientation) GetValue(OrientationProperty);
set => SetValue(OrientationProperty, value);
}
+
+ public static readonly DependencyProperty ContentTemplateProperty = DependencyProperty.Register(
+ "ContentTemplate", typeof(DataTemplate), typeof(Divider), new PropertyMetadata(default(DataTemplate)));
+
+ public DataTemplate ContentTemplate
+ {
+ get => (DataTemplate) GetValue(ContentTemplateProperty);
+ set => SetValue(ContentTemplateProperty, value);
+ }
+
+ public static readonly DependencyProperty ContentStringFormatProperty = DependencyProperty.Register(
+ "ContentStringFormat", typeof(string), typeof(Divider), new PropertyMetadata(default(string)));
+
+ public string ContentStringFormat
+ {
+ get => (string) GetValue(ContentStringFormatProperty);
+ set => SetValue(ContentStringFormatProperty, value);
+ }
+
+ public static readonly DependencyProperty ContentTemplateSelectorProperty = DependencyProperty.Register(
+ "ContentTemplateSelector", typeof(DataTemplateSelector), typeof(Divider), new PropertyMetadata(default(DataTemplateSelector)));
+
+ public DataTemplateSelector ContentTemplateSelector
+ {
+ get => (DataTemplateSelector) GetValue(ContentTemplateSelectorProperty);
+ set => SetValue(ContentTemplateSelectorProperty, value);
+ }
+
+ public static readonly DependencyProperty LineStrokeProperty = DependencyProperty.Register(
+ "LineStroke", typeof(Brush), typeof(Divider), new PropertyMetadata(default(Brush)));
+
+ public Brush LineStroke
+ {
+ get => (Brush) GetValue(LineStrokeProperty);
+ set => SetValue(LineStrokeProperty, value);
+ }
+
+ public static readonly DependencyProperty LineStrokeThicknessProperty = DependencyProperty.Register(
+ "LineStrokeThickness", typeof(double), typeof(Divider), new PropertyMetadata(ValueBoxes.Double1Box));
+
+ public double LineStrokeThickness
+ {
+ get => (double) GetValue(LineStrokeThicknessProperty);
+ set => SetValue(LineStrokeThicknessProperty, value);
+ }
+
+ public static readonly DependencyProperty LineStrokeDashArrayProperty = DependencyProperty.Register(
+ "LineStrokeDashArray", typeof(DoubleCollection), typeof(Divider), new PropertyMetadata(new DoubleCollection()));
+
+ public DoubleCollection LineStrokeDashArray
+ {
+ get => (DoubleCollection) GetValue(LineStrokeDashArrayProperty);
+ set => SetValue(LineStrokeDashArrayProperty, value);
+ }
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Data/Enum/ColLayoutStatus.cs b/src/Shared/HandyControl_Shared/Data/Enum/ColLayoutStatus.cs
index 5deda29f..bf0a6ea9 100644
--- a/src/Shared/HandyControl_Shared/Data/Enum/ColLayoutStatus.cs
+++ b/src/Shared/HandyControl_Shared/Data/Enum/ColLayoutStatus.cs
@@ -8,5 +8,6 @@
Lg,
Xl,
Xxl,
+ Auto
}
}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
index cb3723f0..1156a56d 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
@@ -4,6 +4,32 @@
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Tools/Extension/ColLayout.cs b/src/Shared/HandyControl_Shared/Tools/Extension/ColLayout.cs
index 91785099..4db36da3 100644
--- a/src/Shared/HandyControl_Shared/Tools/Extension/ColLayout.cs
+++ b/src/Shared/HandyControl_Shared/Tools/Extension/ColLayout.cs
@@ -13,6 +13,8 @@ namespace HandyControl.Tools.Extension
{
public static readonly int ColMaxCellCount = 24;
+ public static readonly int HalfColMaxCellCount = 12;
+
public static readonly int XsMaxWidth = 768;
public static readonly int SmMaxWidth = 992;
From 5abf20c1814c3191362dd90e24970077505fbadb Mon Sep 17 00:00:00 2001
From: NaBian <836904362@qq.com>
Date: Sun, 27 Oct 2019 22:46:38 +0800
Subject: [PATCH 3/3] add Divider
---
README.md | 8 ++-
.../UserControl/Controls/DividerDemoCtl.xaml | 44 +++++++++++---
.../HandyControl_Shared/Controls/Grid/Col.cs | 58 +++++++++++--------
.../HandyControl_Shared/Controls/Grid/Row.cs | 2 +-
.../Themes/Styles/Base/DividerBaseStyle.xaml | 38 ++++++++++--
5 files changed, 111 insertions(+), 39 deletions(-)
diff --git a/README.md b/README.md
index d15df9f0..8b23f787 100644
--- a/README.md
+++ b/README.md
@@ -65,6 +65,10 @@ Step 4:enjoy coding
## Latest examples
+### Divider
+
+
+
### GeometryAnimation

@@ -81,6 +85,8 @@ Step 4:enjoy coding

+## History publication
+
### RunningBlock

@@ -91,8 +97,6 @@ Step 4:enjoy coding

-## History publication
-
### Magnifier

diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml
index 5c273b76..37fb29ea 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/DividerDemoCtl.xaml
@@ -2,14 +2,42 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
- Background="{DynamicResource RegionBrush}">
+ Background="{DynamicResource RegionBrush}"
+ xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs">
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Controls/Grid/Col.cs b/src/Shared/HandyControl_Shared/Controls/Grid/Col.cs
index 62c8f908..c94cbc43 100644
--- a/src/Shared/HandyControl_Shared/Controls/Grid/Col.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Grid/Col.cs
@@ -41,36 +41,48 @@ namespace HandyControl.Controls
set => SetValue(SpanProperty, value);
}
+ public static readonly DependencyProperty IsFixedProperty = DependencyProperty.Register(
+ "IsFixed", typeof(bool), typeof(Col), new PropertyMetadata(ValueBoxes.FalseBox));
+
+ public bool IsFixed
+ {
+ get => (bool) GetValue(IsFixedProperty);
+ set => SetValue(IsFixedProperty, value);
+ }
+
internal int GetLayoutCellCount(ColLayoutStatus status)
{
var result = 0;
if (Layout != null)
{
- switch (status)
+ if (!IsFixed)
{
- case ColLayoutStatus.Xs:
- result = Layout.Xs;
- break;
- case ColLayoutStatus.Sm:
- result = Layout.Sm;
- break;
- case ColLayoutStatus.Md:
- result = Layout.Md;
- break;
- case ColLayoutStatus.Lg:
- result = Layout.Lg;
- break;
- case ColLayoutStatus.Xl:
- result = Layout.Xl;
- break;
- case ColLayoutStatus.Xxl:
- result = Layout.Xxl;
- break;
- case ColLayoutStatus.Auto:
- break;
- default:
- throw new ArgumentOutOfRangeException(nameof(status), status, null);
+ switch (status)
+ {
+ case ColLayoutStatus.Xs:
+ result = Layout.Xs;
+ break;
+ case ColLayoutStatus.Sm:
+ result = Layout.Sm;
+ break;
+ case ColLayoutStatus.Md:
+ result = Layout.Md;
+ break;
+ case ColLayoutStatus.Lg:
+ result = Layout.Lg;
+ break;
+ case ColLayoutStatus.Xl:
+ result = Layout.Xl;
+ break;
+ case ColLayoutStatus.Xxl:
+ result = Layout.Xxl;
+ break;
+ case ColLayoutStatus.Auto:
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(status), status, null);
+ }
}
}
else
diff --git a/src/Shared/HandyControl_Shared/Controls/Grid/Row.cs b/src/Shared/HandyControl_Shared/Controls/Grid/Row.cs
index 36670f02..a166b027 100644
--- a/src/Shared/HandyControl_Shared/Controls/Grid/Row.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Grid/Row.cs
@@ -53,7 +53,7 @@ namespace HandyControl.Controls
totalRowCount++;
}
- if (cellCount == 0)
+ if (cellCount == 0 || child.IsFixed)
{
_totalAutoWidth += childDesiredSize.Width;
}
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
index 1156a56d..1a324b26 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/DividerBaseStyle.xaml
@@ -4,24 +4,42 @@