diff --git a/HandyControl/Controls/Attach/BorderElement.cs b/HandyControl/Controls/Attach/BorderElement.cs
index c0352bf9..7ee4455b 100644
--- a/HandyControl/Controls/Attach/BorderElement.cs
+++ b/HandyControl/Controls/Attach/BorderElement.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows;
+using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using HandyControl.Data;
@@ -25,10 +24,6 @@ namespace HandyControl.Controls
{
if ((bool)e.NewValue)
{
- border.SetBinding(FrameworkElement.MinWidthProperty,
- new Binding(FrameworkElement.ActualWidthProperty.Name) { Source = border });
- border.SetBinding(FrameworkElement.MinHeightProperty,
- new Binding(FrameworkElement.ActualHeightProperty.Name) { Source = border });
var binding = new MultiBinding
{
Converter = new BorderCircularConverter()
diff --git a/HandyControl/Controls/Badge/Badge.cs b/HandyControl/Controls/Other/Badge.cs
similarity index 75%
rename from HandyControl/Controls/Badge/Badge.cs
rename to HandyControl/Controls/Other/Badge.cs
index 23faa7f4..85e85c8b 100644
--- a/HandyControl/Controls/Badge/Badge.cs
+++ b/HandyControl/Controls/Other/Badge.cs
@@ -4,6 +4,9 @@ using HandyControl.Data;
namespace HandyControl.Controls
{
+ ///
+ /// 标记
+ ///
public class Badge : ContentControl
{
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
@@ -22,7 +25,7 @@ namespace HandyControl.Controls
{
var ctl = (Badge) d;
var v = (int) e.NewValue;
- ctl.Text = v.ToString();
+ ctl.Text = v <= ctl.Maximum ? v.ToString() : $"{ctl.Maximum}+";
}
public int Value
@@ -41,12 +44,21 @@ namespace HandyControl.Controls
}
public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register(
- "Maximum", typeof(int), typeof(Badge), new PropertyMetadata(ValueBoxes.Int99Box));
+ "Maximum", typeof(int), typeof(Badge), new PropertyMetadata(ValueBoxes.Int99Box, OnValueChanged));
public int Maximum
{
get => (int) GetValue(MaximumProperty);
set => SetValue(MaximumProperty, value);
}
+
+ public static readonly DependencyProperty BadgeMarginProperty = DependencyProperty.Register(
+ "BadgeMargin", typeof(Thickness), typeof(Badge), new PropertyMetadata(default(Thickness)));
+
+ public Thickness BadgeMargin
+ {
+ get => (Thickness) GetValue(BadgeMarginProperty);
+ set => SetValue(BadgeMarginProperty, value);
+ }
}
}
\ No newline at end of file
diff --git a/HandyControl/Controls/Panel/SimplePanel.cs b/HandyControl/Controls/Panel/SimplePanel.cs
index 41e9c532..7f774b8b 100644
--- a/HandyControl/Controls/Panel/SimplePanel.cs
+++ b/HandyControl/Controls/Panel/SimplePanel.cs
@@ -4,6 +4,12 @@ using System.Windows.Controls;
namespace HandyControl.Controls
{
+ ///
+ /// 用以代替Grid
+ ///
+ ///
+ /// 当不需要Grid的行、列分隔等功能时建议用此轻量级类代替
+ ///
public class SimplePanel : Panel
{
protected override Size MeasureOverride(Size availableSize)
diff --git a/HandyControl/HandyControl.csproj b/HandyControl/HandyControl.csproj
index da2a09d7..6e20ed86 100644
--- a/HandyControl/HandyControl.csproj
+++ b/HandyControl/HandyControl.csproj
@@ -109,7 +109,7 @@
-
+
diff --git a/HandyControl/Themes/Styles/Badge.xaml b/HandyControl/Themes/Styles/Badge.xaml
index a6572209..5a1cc0f3 100644
--- a/HandyControl/Themes/Styles/Badge.xaml
+++ b/HandyControl/Themes/Styles/Badge.xaml
@@ -10,23 +10,23 @@
-
-
-
-
-
diff --git a/HandyControl/Themes/Styles/Base/BadgeBaseStyle.xaml b/HandyControl/Themes/Styles/Base/BadgeBaseStyle.xaml
index f17adcc1..d1e7d26e 100644
--- a/HandyControl/Themes/Styles/Base/BadgeBaseStyle.xaml
+++ b/HandyControl/Themes/Styles/Base/BadgeBaseStyle.xaml
@@ -6,24 +6,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HandyControlDemo/UserControl/Controls/BadgeDemoCtl.xaml b/HandyControlDemo/UserControl/Controls/BadgeDemoCtl.xaml
index f030241c..4e91afbc 100644
--- a/HandyControlDemo/UserControl/Controls/BadgeDemoCtl.xaml
+++ b/HandyControlDemo/UserControl/Controls/BadgeDemoCtl.xaml
@@ -5,10 +5,19 @@
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Background="{DynamicResource RegionBrush}">
-
+
-
+
+
+
+
+
+
+
+
+
+
diff --git a/HandyControlDemo/UserControl/Main/LeftMainContent.xaml b/HandyControlDemo/UserControl/Main/LeftMainContent.xaml
index f83e9744..02714bdf 100644
--- a/HandyControlDemo/UserControl/Main/LeftMainContent.xaml
+++ b/HandyControlDemo/UserControl/Main/LeftMainContent.xaml
@@ -388,7 +388,7 @@
-
+
diff --git a/README.md b/README.md
index 35673c7e..62519dd6 100644
--- a/README.md
+++ b/README.md
@@ -39,6 +39,10 @@ Step 3:enjoy coding
## Latest examples
+### Badge
+
+
+
### Gravatar

diff --git a/Resources/Badge.png b/Resources/Badge.png
new file mode 100644
index 00000000..2b015d45
Binary files /dev/null and b/Resources/Badge.png differ