Change header color of calendar that appears with DateTimePicker

5 posts, 1 answers
  1. Brian
    Brian avatar
    10 posts
    Member since:
    Jul 2012

    Posted 30 Nov 2012 Link to this post

    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.
  2. Masha
    Admin
    Masha avatar
    355 posts

    Posted 05 Dec 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Brian
    Brian avatar
    10 posts
    Member since:
    Jul 2012

    Posted 05 Dec 2012 Link to this post

    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?
  5. Answer
    Masha
    Admin
    Masha avatar
    355 posts

    Posted 07 Dec 2012 Link to this post

    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.

  6. Brian
    Brian avatar
    10 posts
    Member since:
    Jul 2012

    Posted 10 Dec 2012 Link to this post

    Thanks for the response, it led me to the solution to the issue.

    BP
Back to Top
UI for WPF is Visual Studio 2017 Ready