This is a migrated thread and some comments may be shown as answers.

Change header color of calendar that appears with DateTimePicker

4 Answers 326 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 30 Nov 2012, 07:53 PM
I would like to be able to change the header color of the calendar (looks remarkably like a RadCalendar) that appears when I click on the button inside the RadDateTimePicker (set to select a date and a time). So far, I have some resources that I put together that are changing normal RadCalendar controls in the application, but these resources do not modify the calendar from the date time picker. Is there a short way to modify this color either in C# code or in XAML? I also put this together:

<Style x:Key="NewStyle" TargetType="{x:Type telerik:RadDateTimePicker}">
  <Setter Property="Control.Background" Value="Red"/>
</Style>


It would be great if there would be something that I could put in there as well to change the header of the calendar. I saw postings that talked about copying and pasting the entire sections from the theme XAML file for the control, but there has to be a shorter way to do this that I am just missing.

Thanks.

4 Answers, 1 is accepted

Sort by
0
Masha
Telerik team
answered on 05 Dec 2012, 11:06 AM
Hi Brian,

You should customize the ControlTemplate of RadCalendarStyle in order to change the header color. Simply search for:

<Border x:Name="Navigation" Margin="0 0 0 -1" Canvas.ZIndex="2"
    Visibility="{TemplateBinding HeaderVisibility}"
    BorderThickness="{StaticResource CalendarHeaderBorderThickness}"
    CornerRadius="{StaticResource CalendarHeaderOuterCornerRadius}"
    BorderBrush="{StaticResource HeaderOuterBorder}"
    Background="{StaticResource HeaderBackground}">

and modify the resources you want.

Hope it helps.

Kind regards,
Maria
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Brian
Top achievements
Rank 1
answered on 05 Dec 2012, 03:34 PM
I have already overridden the RadCalendar style and changed the Background value for the Navigation Border in my global resources XAML file, and it works great if I just use the RadCalendar control by itself. I just cannot figure out how to get the calendar that appears when you click on the button on the right side of the RadDateTimePicker control to use the same style for its calendar that the RadCalendar does.

I also tried to make the change to any of the XAML files in the Telerik themes folder and I rebuilt all of the projects in the solutions, but there was still no change.

Any other ideas?
0
Accepted
Masha
Telerik team
answered on 07 Dec 2012, 08:15 AM
Hello Brian,

You can set CalendarStyle property of the RadDateTimePicker and call the style used for RadCalendar.

The approach is demonstrated in the attached project.

Kind regards,
Maria
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Brian
Top achievements
Rank 1
answered on 10 Dec 2012, 04:28 PM
Thanks for the response, it led me to the solution to the issue.

BP
Tags
DateTimePicker
Asked by
Brian
Top achievements
Rank 1
Answers by
Masha
Telerik team
Brian
Top achievements
Rank 1
Share this question
or