Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Edited Issue: UpDownBase.Value remains out of range if Min or Max changes while ClipValueToMinMax is set [22108]

$
0
0
I am using the Community Edition Extended Toolkit v2.5.0, targeting .NET 4.0 with VS2010.

To reproduce the problem:
1. Create a WPF window with a DoubleUpDown, with control for changing the Minimum at runtime.
2. Set the Minimum = 1, Maximum = 10, ClipValueToMin = True
3. Start application, and set the Value to 2 (above the current minimum.
4. At runtime, change the Minimum to 3 (above the current Value).

The ValidSpinDirection is set correctly (the bottom arrow is disabled), but the Value remains at 2, which is not valid for the new range. Ideally, when the Minimum or Maximum properties change, the current value should be re-evaluated compared to the new Minimum and Maximum if ClipValueToMinMax is true.
Comments: ** Comment from web user: BoucherS **

Hi,

Thanks for pointing this out.
Simply add the following in the file Xceed.Wpf.Toolkit/NumericUpDown/Implementation/CommonNumericUpDown.cs:

```
protected override void OnMinimumChanged( T? oldValue, T? newValue )
{
base.OnMinimumChanged( oldValue, newValue );

if( this.Value.HasValue && this.ClipValueToMinMax )
{
this.Value = this.CoerceValueMinMax( this.Value.Value );
}
}

protected override void OnMaximumChanged( T? oldValue, T? newValue )
{
base.OnMaximumChanged( oldValue, newValue );

if( this.Value.HasValue && this.ClipValueToMinMax )
{
this.Value = this.CoerceValueMinMax( this.Value.Value );
}
}
```
This will be fixed in v3.0.


Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>