diff --git a/HandyControl/Controls/Badge/Badge.cs b/HandyControl/Controls/Badge/Badge.cs
new file mode 100644
index 00000000..3b3cc918
--- /dev/null
+++ b/HandyControl/Controls/Badge/Badge.cs
@@ -0,0 +1,57 @@
+using System.Windows;
+using System.Windows.Controls;
+using HandyControl.Data;
+
+namespace HandyControl.Controls
+{
+ public class Badge : ContentControl
+ {
+ public Badge()
+ {
+
+ }
+
+ public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
+ "Text", typeof(string), typeof(Badge), new PropertyMetadata(default(string)));
+
+ public string Text
+ {
+ get => (string) GetValue(TextProperty);
+ set => SetValue(TextProperty, value);
+ }
+
+ public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
+ "Value", typeof(int), typeof(Badge), new PropertyMetadata(ValueBoxes.Int0Box, OnValueChanged));
+
+ private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var ctl = (Badge) d;
+ var v = (int) e.NewValue;
+ ctl.Text = v.ToString();
+ }
+
+ public int Value
+ {
+ get => (int) GetValue(ValueProperty);
+ set => SetValue(ValueProperty, value);
+ }
+
+ public static readonly DependencyProperty IsDotProperty = DependencyProperty.Register(
+ "IsDot", typeof(bool), typeof(Badge), new PropertyMetadata(ValueBoxes.FalseBox));
+
+ public bool IsDot
+ {
+ get => (bool) GetValue(IsDotProperty);
+ set => SetValue(IsDotProperty, value);
+ }
+
+ public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register(
+ "Maximum", typeof(int), typeof(Badge), new PropertyMetadata(ValueBoxes.Int99Box));
+
+ public int Maximum
+ {
+ get => (int) GetValue(MaximumProperty);
+ set => SetValue(MaximumProperty, value);
+ }
+ }
+}
\ No newline at end of file
diff --git a/HandyControl/Controls/Other/Badge.cs b/HandyControl/Controls/Other/Badge.cs
deleted file mode 100644
index 0eaf688b..00000000
--- a/HandyControl/Controls/Other/Badge.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System.Windows.Controls;
-
-namespace HandyControl.Controls
-{
- public class Badge : ContentControl
- {
-
- }
-}
\ No newline at end of file
diff --git a/HandyControl/Data/ValueBoxes.cs b/HandyControl/Data/ValueBoxes.cs
index b2fb35dc..d53cba75 100644
--- a/HandyControl/Data/ValueBoxes.cs
+++ b/HandyControl/Data/ValueBoxes.cs
@@ -31,6 +31,8 @@
internal static object Int5Box = 5;
+ internal static object Int99Box = 99;
+
internal static object BooleanBox(bool value) => value ? TrueBox : FalseBox;
}
}
\ No newline at end of file
diff --git a/HandyControl/HandyControl.csproj b/HandyControl/HandyControl.csproj
index 4f14d102..0328842d 100644
--- a/HandyControl/HandyControl.csproj
+++ b/HandyControl/HandyControl.csproj
@@ -109,7 +109,7 @@
-
+
@@ -363,6 +363,14 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/HandyControl/Themes/Styles/Badge.xaml b/HandyControl/Themes/Styles/Badge.xaml
new file mode 100644
index 00000000..a6572209
--- /dev/null
+++ b/HandyControl/Themes/Styles/Badge.xaml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/Base/BadgeBaseStyle.xaml b/HandyControl/Themes/Styles/Base/BadgeBaseStyle.xaml
new file mode 100644
index 00000000..811df7bf
--- /dev/null
+++ b/HandyControl/Themes/Styles/Base/BadgeBaseStyle.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/Style.xaml b/HandyControl/Themes/Styles/Style.xaml
index 50479527..41cf4b86 100644
--- a/HandyControl/Themes/Styles/Style.xaml
+++ b/HandyControl/Themes/Styles/Style.xaml
@@ -59,6 +59,7 @@
+
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/Window.xaml b/HandyControl/Themes/Styles/Window.xaml
index a3805129..7588f39f 100644
--- a/HandyControl/Themes/Styles/Window.xaml
+++ b/HandyControl/Themes/Styles/Window.xaml
@@ -96,7 +96,9 @@
-
+
+
+
diff --git a/HandyControlDemo/Properties/Langs/Lang.Designer.cs b/HandyControlDemo/Properties/Langs/Lang.Designer.cs
index 70097234..3ba49d5c 100644
--- a/HandyControlDemo/Properties/Langs/Lang.Designer.cs
+++ b/HandyControlDemo/Properties/Langs/Lang.Designer.cs
@@ -276,6 +276,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 评论 的本地化字符串。
+ ///
+ public static string Comment {
+ get {
+ return ResourceManager.GetString("Comment", resourceCulture);
+ }
+ }
+
///
/// 查找类似 一般 的本地化字符串。
///
@@ -915,6 +924,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
+ ///
+ /// 查找类似 回复 的本地化字符串。
+ ///
+ public static string Reply {
+ get {
+ return ResourceManager.GetString("Reply", resourceCulture);
+ }
+ }
+
///
/// 查找类似 代码仓库 的本地化字符串。
///
diff --git a/HandyControlDemo/Properties/Langs/Lang.en.resx b/HandyControlDemo/Properties/Langs/Lang.en.resx
index b2b8e53a..9c359170 100644
--- a/HandyControlDemo/Properties/Langs/Lang.en.resx
+++ b/HandyControlDemo/Properties/Langs/Lang.en.resx
@@ -510,4 +510,10 @@
Coming Soon
+
+ Comment
+
+
+ Reply
+
\ No newline at end of file
diff --git a/HandyControlDemo/Properties/Langs/Lang.resx b/HandyControlDemo/Properties/Langs/Lang.resx
index dfc893e1..858deaca 100644
--- a/HandyControlDemo/Properties/Langs/Lang.resx
+++ b/HandyControlDemo/Properties/Langs/Lang.resx
@@ -510,4 +510,10 @@
敬请期待
+
+ 评论
+
+
+ 回复
+
\ No newline at end of file
diff --git a/HandyControlDemo/UserControl/Controls/BadgeDemoCtl.xaml b/HandyControlDemo/UserControl/Controls/BadgeDemoCtl.xaml
index 89201f78..e341b740 100644
--- a/HandyControlDemo/UserControl/Controls/BadgeDemoCtl.xaml
+++ b/HandyControlDemo/UserControl/Controls/BadgeDemoCtl.xaml
@@ -1,6 +1,15 @@
-
+ xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
+ xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
+ Background="{DynamicResource RegionBrush}">
+
+
+
+
+
+
+
+