UI value not updated

9 posts, 0 answers
  1. xp
    xp avatar
    13 posts
    Member since:
    Apr 2009

    Posted 29 Nov 2011 Link to this post

    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.


  2. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 23 Jan 2012 Link to this post

    Since I have the same problem I want to know if there is a solution / workarund for this.
    Thanks in advance
    Manfred
  3. UI for WPF is Visual Studio 2017 Ready
  4. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 26 Jan 2012 Link to this post

    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 >>

  5. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 26 Jan 2012 Link to this post

    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
  6. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 30 Jan 2012 Link to this post

    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 >>
  7. Alan
    Alan avatar
    25 posts
    Member since:
    Jan 2013

    Posted 10 May 2013 Link to this post

    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?
  8. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 15 May 2013 Link to this post

    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.

  9. Alan
    Alan avatar
    25 posts
    Member since:
    Jan 2013

    Posted 27 Aug 2013 Link to this post

    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
  10. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 30 Aug 2013 Link to this post

    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 >>
Back to Top
UI for WPF is Visual Studio 2017 Ready