DatePicker in GRidView

8 posts, 1 answers
  1. Siingh
    Siingh avatar
    32 posts
    Member since:
    Jul 2012

    Posted 02 Jun 2011 Link to this post

    Hi Telerik
    can you help in getting DatePicker working in GridView, in WPF
    i have tried this link gridview-how-to-create-date-time-picker-column and Custom Column also none of above work.

    then i tried using simple example with Resources and i can get DatePicker in Grid column but i cant see bounded data in it.

    it always shows me "Enter Date" but no selected date is visible i have binded Gridview using code behind with DataTable()


    Help me please
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 03 Jun 2011 Link to this post

    Hi Siingh,

    I found your same query here  and in several other  forum posts as well .
    To aviod duplication , I will keep further cmmunication in a single place.
    You may find my further answers ( and a sample project ) there .

    Regards,
    Pavel Pavlov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Saykor
    Saykor avatar
    70 posts
    Member since:
    Feb 2011

    Posted 09 Oct 2014 Link to this post

    Hi,
    It will be good to update your example at http://www.telerik.com/help/wpf/gridview-how-to-create-date-time-picker-column.html

    It break on the styles because you assume we will use RadClockStyle.

    And the second problem is with binding property. It is set to Established. Of course I can change to my needs for example StartDate but what is suppose for another property let say EndDate? I need to build another DateTimePickerColumnVersion2?

    The official example not work as universal reusable solution. It is for specific case and will be good if is updated to work as is suppose.

    Regards,


  4. Boris
    Admin
    Boris avatar
    276 posts

    Posted 14 Oct 2014 Link to this post

    Hi Saykor,

    In general the Create Custom DateTimePicker Column article is meant to guide you through the common task of creating a custom column in RadGridView and not to be an universal solution. However, if it does not suit your needs, you can use it as a template that can be modified or rewritten for your specific case. In addition the RadClockStyle is only used to set a custom Header to RadTimePicker. A possible reason for it to break is because you are using full binaries instead of NoXAML. To use the style with full binaries you can remove it's BasedOn property. In addition if you do not need the custom header at all, you can just remove it.

    I hope this helps.

    Regards,
    Boris Penev
    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.

     
  5. Saykor
    Saykor avatar
    70 posts
    Member since:
    Feb 2011

    Posted 14 Oct 2014 Link to this post

    Hi Boris,
    Again I will ask for a universal solution provided from a Telerik team because nobody will make it more good from Telerik itself.
    High-Quality Programming Code is reusable and it is suppose to be in the official Telerik's articles.

    Other question is after so much years of existing on Telerik radgridview for WPF why so much other cases on different Columns is not implemented in the control and we need to do them manually.

    But for now how to build Reusable Custom Column will be good.

    Regards,
  6. Answer
    Boris
    Admin
    Boris avatar
    276 posts

    Posted 16 Oct 2014 Link to this post

    Hello Saykor,

    In order to try and make the code more reusable I changed the binding of the SelectedValue property of the RadDatePicker and RadTimePicker controls, located in the CustomDateTimePicker.xaml file. Now they are bound to the SelectedDate dependency property of the CustomDateTimePicker class. Thus avoiding the hard codded binding to the Established property of the Club class.

    <UserControl x:Class="CustomDateTimePickerColumn_WPF.CustomDateTimePicker"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:local="clr-namespace:CustomDateTimePickerColumn_WPF"
                 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.Resources>
                <Style x:Key="RadClockStyle" TargetType="telerik:RadClock">
                    <Setter Property="Header" Value="TimePicker" />
                </Style>
            </Grid.Resources>
            <telerik:RadDatePicker x:Name="Calendar"
                                   SelectedValue="{Binding SelectedDate,
                                                           RelativeSource={RelativeSource AncestorType={x:Type local:CustomDateTimePicker}}}"
                                   SelectionChanged="OnCalendarSelectionChanged" />
            <telerik:RadTimePicker x:Name="TimePicker"
                                   Grid.Column="1"
                                   ClockStyle="{StaticResource RadClockStyle}"
                                   SelectedValue="{Binding SelectedDate,
                                                           RelativeSource={RelativeSource AncestorType={x:Type local:CustomDateTimePicker}}}"
                                   SelectionChanged="OnTimePickerSelectionChanged" />
        </Grid>
    </UserControl>

    I attached a sample project demonstrating the suggested approach. Could you please examine it and let us know if that was what you had in mind?


    Regards,
    Boris Penev
    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.

     
  7. Saykor
    Saykor avatar
    70 posts
    Member since:
    Feb 2011

    Posted 20 Oct 2014 Link to this post

    Thank you
    This is exactly what I need. Unfortunate I can't select it as a answer because i not start this thread.
  8. Boris
    Admin
    Boris avatar
    276 posts

    Posted 21 Oct 2014 Link to this post

    Hi Saykor,

    I am glad that my solution was able to fulfill your requirement. In addition I marked as answer my previous reply.

    Regards,
    Boris Penev
    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.

     
Back to Top