Explicit UpdateSource() with RadDatePicker

6 posts, 0 answers
  1. Tim
    Tim avatar
    3 posts
    Member since:
    Apr 2007

    Posted 18 Dec 2008 Link to this post

    I have a wpf window with a search button and some fields to enter the search criteria. Some of the search fields are RadDatePicker controls which are bound to a custom object. Wpf does not update the custom object with changes until the field loses focus. When the search button is clicked, my code checks if each field has the focus. If it does, it calls UpdateSource() on the BindingExpression to make sure the custom object has the current values.

    This is not working with RadDatePicker. I call UpdateSource() and it does not update the value in my custom object. I am binding to the SelectedDate property. Everything works fine when I tab out of the RadDatePicker control before clicking the search button.

    Is there a way tell RadDatePicker to update the source without moving the focus?

    The IsFocused property on RadDatePicker never seems to be true so that might be a bug.

  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 23 Dec 2008 Link to this post

    Hi Tim,

    The UpdateSource() will not work in your case because the problem is in the fact that the value of the DatePicker is not updated until focus is lost or Enter key is pressed.

    We have not provided a way to manually update the Value of the DatePicker. There is a method for this, but it is not publicly visible. If this is an issue for you, we will fix this and send you an update (or you can wait until the next Service Pack in January.

    Unfortunately I connot think of a workaround for this.

    Thanks for pointing the problem with the IsFocused property. This is a bug and we will look into it. Your Telerik Points have been updated for your involvement.

    Sincerely yours,
    Miroslav
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Lisa
    Lisa avatar
    2 posts
    Member since:
    Jan 2012

    Posted 25 Jan 2012 Link to this post

    Its January 2012 and the control still behaves the same way.  I see the feedback was from December 2008, with a proposed fix in January 2009.  Was this bug fixed and if not, do you have a work around?
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 31 Jan 2012 Link to this post

    Hello Lisa,

    The UpdateSource() method seems to work as expected. Please find attached a sample project in which it is illustrated its use.

    Hope this helps.

    Kind regards,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  6. Lisa
    Lisa avatar
    2 posts
    Member since:
    Jan 2012

    Posted 31 Jan 2012 Link to this post

    Hello Konstantina,

    Thank you for the code.  The reason it works on your sample is because the click event is in the code behind on the xaml and when it is clicked the date picker control looses focus, setting the value.  In MVVM design pattern there is no code behind, and the button actually exists on another view (xaml) file.  This means that the control never really looses focus.  What is Teleriks work around for this design pattern?

    Regards,
    Lisa 
  7. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 03 Feb 2012 Link to this post

    Hello,

    Ok, I have modified the project, so that the UpdateSource() is called on a timer tick. Could you please try to reproduce the issue you are experiencing in the attached project and send it back to us. In that way we will be able to track down the source of the problem and provide you with solution.

    All the best,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top
UI for WPF is Visual Studio 2017 Ready