I have a UserControl
with a ListBox
and a DoubleUpDown
. When I select the item in the ListBox
I want to set the Minimum
, Maximum
and the Value
of the DoubleUpDown
so the user can change the Value
not from predefined range, but in some range around the given value. I use this code:
<extToolkit:DoubleUpDown Increment="0.1" Value="{Binding SelectedItem.MyValue, ElementName=listBox1, UpdateSourceTrigger=PropertyChanged, Converter={conv:CheckValue}}" FormatString="0.0">
<extToolkit:DoubleUpDown.Maximum>
<MultiBinding Converter="{conv:CorMaximum}">
<Binding Path="SelectedItem.MyValue" ElementName="listBox1" />
<Binding Path="SelectedItem.MaxDif" ElementName="listBox1" />
</MultiBinding>
</extToolkit:DoubleUpDown.Maximum>
<extToolkit:DoubleUpDown.Minimum>
<MultiBinding Converter="{conv:CorMinimum}">
<Binding Path="SelectedItem.MyValue" ElementName="listBox1" />
<Binding Path="SelectedItem.MaxDif" ElementName="listBox1" />
</MultiBinding>
</extToolkit:DoubleUpDown.Minimum>
</extToolkit:DoubleUpDown>
The problem is that this code first set the Value
and after that set the Minimum
and Maximum
so if I have this values:
Name | MyValue | MaxDif
-----------------------
One | 6 | 2
Two | 1 | 1
The range for One is 4..8 and the range for Two is 0..2. If I first select One and then Two it looks like the Two.MyVal = 4
, because the value is inserted when the range from One is still active.
How to change the code to first set the Minimum
and Maximum
and after that set the Value
?