<Style TargetType="Calendar" x:Key="CalenderStyleNew"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Calendar"> <StackPanel HorizontalAlignment="Center" x:Name="Root"> <Calendar x:Name="Calendar" SelectedDate="{TemplateBinding SelectedDate}" removed="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" > <Calendar.CalendarDayButtonStyle> <Style> <Setter Property="Button.Height" Value="50"></Setter> <Setter Property="Button.Width" Value="50"></Setter> <Setter Property="Button.FontSize" Value="20"></Setter> </Style> </Calendar.CalendarDayButtonStyle> <Calendar.CalendarButtonStyle> <Style> <Setter Property="Button.Height" Value="50"> </Setter> <Setter Property="Button.Width" Value="50"> </Setter> <Setter Property="Button.FontSize" Value="20"> </Setter> </Style> </Calendar.CalendarButtonStyle> </Calendar> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> <DataTemplate x:Key="DateTemplate" > <StackPanel Width="100" Height="20" Orientation="Horizontal" > <Border removed="Black" BorderBrush="Black" BorderThickness="1"> <TextBlock Width="20" Text="{Binding DOB, StringFormat={}{0:dd}}" FontSize="14" FontWeight="Bold" HorizontalAlignment="Center" Foreground="White" removed="Black" /> </Border> <Border removed="Bisque" BorderBrush="Black" BorderThickness="1"> <TextBlock Width="30" Text="{Binding DOB, StringFormat={}{0:MMM}}" FontSize="14" HorizontalAlignment="Center" Foreground="Red" removed="Bisque"/> </Border> <Border removed="Green" BorderBrush="Black" BorderThickness="1"> <TextBlock Width="50" Text="{Binding DOB, StringFormat={}{0:yyyy}}" FontSize="14" HorizontalAlignment="Center" Foreground="Red" removed="Green"/> </Border> </StackPanel> </DataTemplate> <!--working code--> <DataTemplate x:Key="EditingDateTemplate"> <DatePicker SelectedDate="{Binding DOB}" CalendarStyle="{DynamicResource CalenderStyleNew }" /> </DataTemplate> <dg:DataGrid.Columns> <dg:DataGridTextColumn ElementStyle="{StaticResource MyStyle}" EditingElementStyle="{StaticResource WrapStyle}" Header="Author ID" Binding="{Binding Path=AuthorID}" /> <dg:DataGridTemplateColumn Header="DOB" CellTemplate="{DynamicResource DateTemplate}" CellEditingTemplate="{DynamicResource EditingDateTemplate}" /> </dg:DataGrid.Columns>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)