Column bound to DateTime field doesn't handle Time.

3 posts, 0 answers
  1. Joel Palmer
    Joel Palmer avatar
    175 posts
    Member since:
    May 2009

    Posted 06 Mar 2015 Link to this post

    When I bind a GridViewDataColumn to a DateTime field, I am not allowed to set the Time.  Seems like a reasonable expectation. 

    The default state of the column seems to give us the worst of both worlds because the time is displayed when not edited but when we are in edit mode I can't change it.  If the default is just a calendar then don't display the time in the column.  If the default is to handle time then expose the RadDateTimeEditor instead of the RadDateEditor while editing.

    How can I accomplish what I want?  Is it a setting in XAML or do I need to capture the column on creation and define it differently?  I'm always appreciative of XAML and Code examples.

    Joel.
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 10 Mar 2015 Link to this post

    Hi Joel,

    You can easily update the editing element with the help of a CellEditTemplate like that: 
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
                                               Header="Est."
                                               DataFormatString="{}{0:yyyy}">
                       <telerik:GridViewDataColumn.CellEditTemplate>
                           <DataTemplate>
                               <telerik:RadDateTimePicker SelectedDate="{Binding Established}" />
                           </DataTemplate>
                       </telerik:GridViewDataColumn.CellEditTemplate>
                   </telerik:GridViewDataColumn>


    Regards,
    Maya
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Joel Palmer
    Joel Palmer avatar
    175 posts
    Member since:
    May 2009

    Posted 10 Mar 2015 in reply to Maya Link to this post

    Thanks for your reply.  I'll try it out.

    Joel.
Back to Top