From f41d2993380e9f7719b1f93dca4eec5444441a41 Mon Sep 17 00:00:00 2001 From: heartacker Date: Thu, 21 Mar 2024 15:30:53 +0800 Subject: [PATCH] should not SyncTextAndValue while fromTextToValue and clamp --- src/Ursa/Controls/NumericUpDown/NumericUpDownBase.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Ursa/Controls/NumericUpDown/NumericUpDownBase.cs b/src/Ursa/Controls/NumericUpDown/NumericUpDownBase.cs index ec4aeff..c4c96e3 100644 --- a/src/Ursa/Controls/NumericUpDown/NumericUpDownBase.cs +++ b/src/Ursa/Controls/NumericUpDown/NumericUpDownBase.cs @@ -565,7 +565,14 @@ public abstract class NumericUpDownBase : NumericUpDown where T : struct, ICo } if (!Equals(newValue, Value)) { - SetCurrentValue(ValueProperty, newValue); + if (Equals(Clamp(newValue, Maximum, Minimum), newValue)) + { + SetCurrentValue(ValueProperty, newValue); + } + else + { + parsedTextIsValid = false; + } } } catch