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

Explicit UpdateSource() with RadDatePicker

5 Answers 180 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 18 Dec 2008, 08:13 PM
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.

5 Answers, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 23 Dec 2008, 02:28 PM
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.
0
Lisa
Top achievements
Rank 1
answered on 25 Jan 2012, 10:55 PM
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?
0
Konstantina
Telerik team
answered on 31 Jan 2012, 11:17 AM
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 >>
0
Lisa
Top achievements
Rank 1
answered on 31 Jan 2012, 04:54 PM
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 
0
Konstantina
Telerik team
answered on 03 Feb 2012, 08:39 AM
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 >>
Tags
DatePicker
Asked by
Tim
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Lisa
Top achievements
Rank 1
Konstantina
Telerik team
Share this question
or