diff --git a/src/Shared/HandyControl_Shared/Controls/Other/Badge.cs b/src/Shared/HandyControl_Shared/Controls/Other/Badge.cs index 06864f12..fb2cdb26 100644 --- a/src/Shared/HandyControl_Shared/Controls/Other/Badge.cs +++ b/src/Shared/HandyControl_Shared/Controls/Other/Badge.cs @@ -63,8 +63,15 @@ namespace HandyControl.Controls } public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register( - "Maximum", typeof(int), typeof(Badge), new PropertyMetadata(ValueBoxes.Int99Box, OnValueChanged)); - + "Maximum", typeof(int), typeof(Badge), new PropertyMetadata(ValueBoxes.Int99Box, OnMaximumValueChanged)); + + private static void OnMaximumValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + var ctl = (Badge) d; + var v = ctl.Value; + ctl.SetCurrentValue(TextProperty, v <= ctl.Maximum ? v.ToString() : $"{ctl.Maximum}+"); + } + public int Maximum { get => (int) GetValue(MaximumProperty);