DateTimePicker focus

5 posts, 0 answers
  1. Jason D
    Jason D avatar
    76 posts
    Member since:
    Jan 2011

    Posted 03 Jan Link to this post

    This is my first attempt with this grid. One of my columns contains datetime values. Because I want the button for the editor to always be visible, I created a CellTemplate as I saw mentioned in the forum. This works fine. However, once I'm in the editor, nothing will close or hide the editor, even if I click on another cell or control or hit Escape.

    <telerik:GridViewDataColumn DataMemberBinding="{Binding Timestamp}" Width="200">
        <telerik:GridViewDataColumn.CellTemplate>
            <DataTemplate>
                <telerik:RadDatePicker SelectedDate="{Binding Timestamp}" IsTooltipEnabled="False"/>
            </DataTemplate>
        </telerik:GridViewDataColumn.CellTemplate>
    </telerik:GridViewDataColumn>
  2. Jason D
    Jason D avatar
    76 posts
    Member since:
    Jan 2011

    Posted 05 Jan in reply to Jason D Link to this post

    Ok, after spending more time with the DatePicker I figured out this is the correct behavior. However, I need to change the style so that *only* the button is shown when the cell is not in edit mode. I think I can figure this out but will post back if not.

    I'm also having issues with the date range. I see you added IsInputRestrictedToSelectableDates to the Q1 2016 release. How can I replicate that with the 2014.3 release?

    Do I bind SelectedDate or SelectedValue? Finally, regardless of which one I bind to, the content is always left-aligned, even if I specify right-aligned. Thanks!

  3. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    350 posts

    Posted 06 Jan Link to this post

    Hi Jason,

    You can use a RadDateTimePicker as shown in the following article - How to use RadDateTimePicker in a Grid. Would this work for you? Eventually, you can modify the RadDateTimePicker so that it meets your visual requirements.

    Regards,
    Stefan Nenchev
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  4. Jason D
    Jason D avatar
    76 posts
    Member since:
    Jan 2011

    Posted 06 Jan in reply to Stefan Nenchev Link to this post

    Right, I saw that. It's my other two problems that are now causing issues (see my follow-up reply).
  5. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    350 posts

    Posted 10 Jan Link to this post

    Hi Jason,

    In order to set the alignment of the RadDateTimePicker you can edit its control template and modify the RadWatermarkTextBox element that is contained so that its TextAlignment property is set to Right.  A possible solution would also be to change it when the RadDateTimePicker is loaded:

    private void RadDateTimePicker_Loaded(object sender, RoutedEventArgs e)
           {
              (sender as RadDateTimePicker).ChildrenOfType<RadWatermarkTextBox>().FirstOrDefault().TextAlignment = TextAlignment.Right;
           }

    Unfortunately, replicating the IsInputRestrictedToSelectableDates functionalitywould not be that straightforward so you will need to come up with some custom solution at your end or consider upgrading the control's version.  

    Regards,
    Stefan Nenchev
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top