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] 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 @@