RadDateTimePicker SelectedValue does not update

4 posts, 0 answers
  1. Costin
    Costin avatar
    1 posts
    Member since:
    Mar 2012

    Posted 18 Mar 2013 Link to this post

    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
  2. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 21 Mar 2013 Link to this post

    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.

  3. DevCraft banner
  4. Heiko
    Heiko avatar
    124 posts
    Member since:
    Oct 2012

    Posted 09 Apr 2013 Link to this post

    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
  5. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 11 Apr 2013 Link to this post

    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.

Back to Top