This is a migrated thread and some comments may be shown as answers.

UI value not updated

8 Answers 345 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
xp
Top achievements
Rank 1
xp asked on 29 Nov 2011, 10:03 PM
In my WPF application, I have  NumericUpDown like that

<telerik:RadNumericUpDown Margin="0, 4, 0, 4"  Value="{Binding MyValue, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Maximum="{Binding MaxWidthValue}" IsEnabled="{Binding IsPropertyEnabled}"/>  MyValue is changed from data.

The problem is :

If this RadNumericUpDown has focus, the UI value does not change even though MyValue changed in Data. As soon as Tab out from this control, UI will change immediately.

If this control does not have focus, the UI displayed value will change instantly as MyValue changes.


8 Answers, 1 is accepted

Sort by
0
ManniAT
Top achievements
Rank 2
answered on 23 Jan 2012, 01:23 PM
Since I have the same problem I want to know if there is a solution / workarund for this.
Thanks in advance
Manfred
0
Boyan
Telerik team
answered on 26 Jan 2012, 12:35 PM
Hi,

This is the expected behavior of the control. The value is not updated when you are editing it as this will result in problems when you are entering Value and the data is changed in the meantime.

If you wish to workaround this behavior you can remove the focus and then focus again the control and this will update the Value.

All the best,
Boyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
ManniAT
Top achievements
Rank 2
answered on 26 Jan 2012, 12:40 PM
Hy Boyan,

thank you for your response.
Unfortunately it's not possible (without a very large amount of coding) to remove the focus.
The reason - I have (next to other controls) a TextBlock bound to the value.
This TextBlock can be dragged around which changes the value in the RadNumericUpDown.
Since a TextBlock is not focusable the focus stays on the RadNumericUpDown.

The same happens in another scenario where the value is bound to a property which changes "somehow in the background".

Regards
Manfred
0
Konstantina
Telerik team
answered on 30 Jan 2012, 03:41 PM
Hello Manfred,

I can suggest you the following approach, even though that changing the value while the NumericUpDown control is in edit mode is considered as inconsistent behaviour:
- inherit the NumericUpDown control and override its OnValueChanged property. In it, after the base call, call the ChangeValue method with 0 as parameter:

public class MyNumeric : RadNumericUpDown
    {
        protected override void OnValueChanged(RadRangeBaseValueChangedEventArgs e)
        {
            base.OnValueChanged(e);
            ChangeValue(0);
        }
    }

However, we don't guarantee that the control will still have consistent behaviour, and some side effects and malfunction is highly possible.

All the best,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Alan
Top achievements
Rank 1
answered on 10 May 2013, 06:13 PM
I have implemented this fix, but am concerned about the side-effects that you are mentioning.
Can you explain a bit more the kinds of problems I might encounter?
0
Konstantina
Telerik team
answered on 15 May 2013, 01:18 PM
Hello Alan,

We haven't tested this scenario, so I cannot give you a concrete list of problems, but manipulating the value may affect unforseen aspects of the work of the control. That is why we cannot guarantee the proper behavior of the control.

All the best,
Konstantina
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alan
Top achievements
Rank 1
answered on 27 Aug 2013, 09:14 PM
I have tried the the above workaround, but as you point out it has some bad side effects on the control.
I want to try the other suggested workaround above by changing focus:
   If you wish to workaround this behavior you can remove the focus and then focus again the control and this will update the Value.
I have looked into manipulating focus and it can be quire complicated and error prone.

Can you please explain exactly how to accomplish and which methods to call on the control to make this happen correctly?


Thanks,
 Alan
0
Vladi
Telerik team
answered on 30 Aug 2013, 02:33 PM
Hello,

As previously mentioned the described scenario is considered inconsistent behavior and using a workaround is not recommended as it may lead to some unexpected behaviors. There are may possible approaches in moving the focus from the control and then resetting it to it that you can find by searching the web.

I created a sample project for you that shows one possible approach. As mentioned before we do not recommend the use of the mentioned workarounds as they are working around a scenario that is considered inconsistent behavior in the current version of the control.

Regards,
Vladi
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
NumericUpDown
Asked by
xp
Top achievements
Rank 1
Answers by
ManniAT
Top achievements
Rank 2
Boyan
Telerik team
Konstantina
Telerik team
Alan
Top achievements
Rank 1
Vladi
Telerik team
Share this question
or