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">
<Setter.Value>
<ControlTemplate TargetType="dg:Calendar" >
<dg:CalendarItem Name="myCalendarItem"
removed="Yellow"
BorderBrush="Black"
BorderThickness="1"
VerticalAlignment="Center" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="EffDateDateTimePickerControl">
<TextBlock Text="{Binding DOB, StringFormat=d}" />
</DataTemplate>
<DataTemplate x:Key="addrEffDate">
<dg:DatePicker x:Name="dpEffDate" Text="{Binding Path=effectiveDate,Mode=TwoWay}"
SelectedDate ="{Binding DOB}" SelectedDateFormat="Short"
CalendarStyle="{DynamicResource CalenderControlTemplate}" />
</DataTemplate>
for mainwindow.xaml the code is given below
<dg:DataGridTemplateColumn CellEditingTemplate ="{StaticResource addrEffDate}" CellTemplate="{StaticResource EffDateDateTimePickerControl}" Header="Effective Date">
</dg:DataGridTemplateColumn>
</dg:DataGrid.Columns>
please somebody help to resolve this
Regards
Iqbal