From a2cf40c812b3f52796890047d33dec1e22a38988 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 12 May 2023 15:08:33 +0200 Subject: [PATCH] Use `IsSet` instead of hardcoded values --- src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs b/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs index e97692b255..b5be12fa54 100644 --- a/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs +++ b/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs @@ -659,9 +659,9 @@ namespace Avalonia.Controls } else { - // if Minimum is set (i.e: Minimum is greater than decimal.MinValue) we set value to Minimum on Increment. + // if Minimum is set we set value to Minimum on Increment. // otherwise we set value to 0. It ill be clamped to be between Minimum and Maximum later, so we don't need to do it here. - result = Minimum > decimal.MinValue ? Minimum : 0; + result = IsSet(MinimumProperty) ? Minimum : 0; } SetCurrentValue(ValueProperty, MathUtilities.Clamp(result, Minimum, Maximum)); @@ -680,9 +680,9 @@ namespace Avalonia.Controls } else { - // if Maximum is set (i.e: Maximum is smaller than decimal.MaxValue) we set value to Maximum on decrement. + // if Maximum is set we set value to Maximum on decrement. // otherwise we set value to 0. It ill be clamped to be between Minimum and Maximum later, so we don't need to do it here. - result = Maximum < decimal.MaxValue ? Maximum : 0; + result = IsSet(MaximumProperty) ? Maximum : 0; } SetCurrentValue(ValueProperty, MathUtilities.Clamp(result, Minimum, Maximum));