Click here to Skip to main content
13,045,422 members (68,582 online)
Rate this:
Please Sign up or sign in to vote.
Hi friends,

I have a DataGrid in WPF. which is binded to a MS Access DataBase. one of its column is DateTime type. and its heading name is "DOB".

Now I want to embeds the calender in my DataGrid cell. so that I can enter the Date by clicking on appropriate cells in the Calender.I was able to display the calender but unfortunately the calender always shows 2012 and it do not respond the mouse click. ie as expected when we click a cell in the DataGrid a pop up calender will appear. which have both front and back arrows, while clicking this arrow it should go to next or previous year.

Similarly when we click on a cell that particular Date should appear in the Datagrid cell. this is not happening . exactly I am getting a Dead Calender.

I am giving the code for resource dictionary and mainwindow.xaml respectively
<Style TargetType="{x:Type dg:Calendar}" x:Key="CalenderControlTemplate">
        <Setter Property="Template">
                <ControlTemplate TargetType="dg:Calendar" >
                    <dg:CalendarItem Name="myCalendarItem" 
                                 VerticalAlignment="Center" />
    <DataTemplate x:Key="EffDateDateTimePickerControl">
        <TextBlock Text="{Binding DOB, StringFormat=d}"  />
    <DataTemplate x:Key="addrEffDate">
        <dg:DatePicker x:Name="dpEffDate" Text="{Binding Path=effectiveDate,Mode=TwoWay}"
                     SelectedDate ="{Binding DOB}" SelectedDateFormat="Short"
                   CalendarStyle="{DynamicResource CalenderControlTemplate}" />

for mainwindow.xaml the code is given below
<dg:DataGridTemplateColumn CellEditingTemplate ="{StaticResource addrEffDate}" CellTemplate="{StaticResource  EffDateDateTimePickerControl}"  Header="Effective Date">

please somebody help to resolve this

Posted 31-Jan-12 5:46am
Updated 31-Jan-12 8:22am

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 | Mobile
Web01 | 2.8.170713.1 | Last Updated 31 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