This commit is contained in:
NaBian committed 2021-01-05 00:02:11 +08:00
1 parent 42734d8bd7
commit f069b5236d
1 file changed
+2 -2
@@ -22,7 +22,7 @@ namespace HandyControl.Controls
} }
public static readonly DependencyProperty TextProperty = DependencyProperty.Register( public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
"Text", typeof(string), typeof(Badge), new PropertyMetadata(default(string))); "Text", typeof(string), typeof(Badge), new PropertyMetadata("0"));
public string Text public string Text
{ {
@@ -37,7 +37,7 @@ namespace HandyControl.Controls
{ {
var ctl = (Badge) d; var ctl = (Badge) d;
var v = (int) e.NewValue; var v = (int) e.NewValue;
ctl.Text = v <= ctl.Maximum ? v.ToString() : $"{ctl.Maximum}+"; ctl.SetCurrentValue(TextProperty, v <= ctl.Maximum ? v.ToString() : $"{ctl.Maximum}+");
if (ctl.IsInitialized) if (ctl.IsInitialized)
{ {
ctl.RaiseEvent(new FunctionEventArgs<int>(ValueChangedEvent, ctl) ctl.RaiseEvent(new FunctionEventArgs<int>(ValueChangedEvent, ctl)