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

The changed template does not respect theme

3 Answers 60 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
BishMan
Top achievements
Rank 1
BishMan asked on 21 May 2013, 05:29 PM
I am trying to adjust the template of RadDatePicker to add today button, I modified the template included below.  But I can not get it to respect the theme.  The rad button I added respect the theme not the calendar.   I have couple of questions:

  • How can I change the template to respect the theme selected for the application?
  • How can I hook up the today button to select the today's date.
  • Do I need to include the entire tempatle?

Hope you can provide some help.

3 Answers, 1 is accepted

Sort by
0
BishMan
Top achievements
Rank 1
answered on 21 May 2013, 05:37 PM
I can not seem to load the template it keeps failing.  

Any suggestions?
0
BishMan
Top achievements
Rank 1
answered on 21 May 2013, 09:41 PM
Basically, I changed the
<ControlTemplate TargetType="{x:Type Telerik_Windows_Controls_Calendar:CalendarView}">

to add another row to the grid, and I added the "Today" and "Clear" buttons to that row.  But the template I created from Expression blend has all the colors hard coded for example the border color below: 

<Border x:Name="Header"
    BorderBrush="{TemplateBinding BorderBrush}"
    BorderThickness="{TemplateBinding BorderThickness}"
    Margin="0"
    Visibility="{TemplateBinding HeaderVisibility}">
    <Border.Background>
        <LinearGradientBrush EndPoint="0.5,1"  StartPoint="0.5,0">
            <GradientStop Color="White"
              Offset="0" />
            <GradientStop Color="#FFCDCDCD"
              Offset="1" />
            <GradientStop Color="#FFCECECE"
              Offset="0.42" />
            <GradientStop Color="#FFAFAFAF"
             Offset="0.43" />
        </LinearGradientBrush>
    </Border.Background>

Obviously, I want those to respect the theme, how can I do that?  this is just an example of one area.

0
Vladi
Telerik team
answered on 24 May 2013, 02:23 PM
Hello,

In the current version of RadDatePicker there isn't a built in feature that could be used in order to achieve the desired behavior but it is easily achievable. You will need to customize the Template of the RadDateTimePicker Style and add the necessary today button. In that Template add a RadButton and bind its Command to the telerik:RadDateTimePickerCommands.SetToday command.

You could take a look at our online SDK repositories TodayButton example  that shows how to achieve the desired behavior in the DateTimePicker control, the same approach is applicable for the DatePicker control. You could find more details about how to use the SDK project and solutions in this blog post.

Hope this is helpful.

Regards,
Vladi
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DatePicker
Asked by
BishMan
Top achievements
Rank 1
Answers by
BishMan
Top achievements
Rank 1
Vladi
Telerik team
Share this question
or