Click here to Skip to main content
13,143,628 members (27,136 online)
Rate this:
Please Sign up or sign in to vote.
See more:
how I can set a particular column as calender column which displays both time and date , in DataGrid of WPF
Posted 13-Jan-12 7:59am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

ok man you have to add a template field and inside this field you can add any control you want ex:
<asp:TemplateField HeaderText="Date" >
            <--Add here a date time controll or calendar--;" ></asp:TextBox>
Shmuel Zang 16-Jan-12 3:54am
Nice ASP.NET solution. But, this question is about WPF...
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You can use a DataGridTemplateColumn for that purpose.

You can set the DataTemplate of your column, like the following:

<DataGrid ItemsSource="{Binding MyObjectsProperty}">
        <DataGridTemplateColumn Header="My calendar column">
                    <!-- Replace following DataTemplate with a calendar DataTemplate -->
                    <Border BorderBrush="Blue" Background="LightBlue" BorderThickness="2" Padding="10">
                        <TextBlock Text="{Binding MyDateProperty}" />

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 16 Jan 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100