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

[Solved] RadDateTimePicker SelectedValue does not update

3 Answers 415 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Costin
Top achievements
Rank 1
Costin asked on 18 Mar 2013, 12:55 PM
Hi,

I have a screen which contains some textboxes, a RadDateTimePicker  and a RadSplitButton. 
If I modify the RadDateTimePicker value by typing and then I click on RadSplitButton, the selected value is not updated. If instead of clicking on RadSplitButton, I click on another control the update is working fine.

From what I understood the binding is updated when the focus is lost and from what I see the RadSplitButton doesn't receive the focus after user click.

The value is used in mycustomaction from the code below.

<telerik:RadSplitButton Margin="2" MinWidth="84" Height="24" IsTabStop="True"
                                        Content="{Binding Release, Source={StaticResource Localization}}"
                                        IsEnabled="{Binding IsEnabled, ElementName=SaveButton}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <actions:mycustomaction />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>

Do you know how I can make the SelectedValue to update? or do you know any workaround for this?

Thank you

3 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 21 Mar 2013, 12:03 PM
Hello Costin,

You have correctly recognized what is causing this behavior. RadDateTimePicker updates its value on losing focus and when clicking the RadSplitButton it doesn't get the focus. This is by design and you can achieve the desired behavior by hooking to the Click event of the RadSplitButton and invoke the Focus() method. Thus the button will be focused and the value updated.

All the best,
Boyan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Heiko
Top achievements
Rank 1
answered on 09 Apr 2013, 09:21 AM
Hi Boyan,

you mention that RadDateTimePicker updates its value only on LostFocus event. In my opinion this is a not so good behavior. Let's say I have a form with some textboxes and one RadDateTimePicker. By changing something in the textboxes the underlying binded property gets its update immediately. Now there is one input field for dates which has a totally different behavior - in my opinion this is confusing the user because what he expects is the same behavior on ALL input fields.

Just my opinion, maybe Telerik should think this over.

Regards
Neils
0
Boyan
Telerik team
answered on 11 Apr 2013, 04:25 PM
Hello Neils,

I will try to explain why we have implemented the behavior this way. Now the value is updated on pressing "Enter" or removing the focus. If we parse this on every keystroke and want to enter 12.04  for example when enter "1" the Value will be parsed to 01.04.2013 and it will give value that we don't want, which is a problem, as we may have validation that doesn't allow values before today - so this will be invalid value and it will confuse the application logic.And this is just one of the scenarios.

 in our opinion if we introduce such behavior it will cause more problems than it solves. Also with the current implementation the Value is coupled with Text value of the control and if write "1" the TextBox will be automatically populated with the parsed Value which will prevent further entering of digits.

Greetings,
Boyan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DateTimePicker
Asked by
Costin
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Heiko
Top achievements
Rank 1
Share this question
or