The changed template does not respect theme

4 posts, 0 answers
  1. BishMan
    BishMan avatar
    11 posts
    Member since:
    May 2013

    Posted 21 May 2013 Link to this post

    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.
  2. BishMan
    BishMan avatar
    11 posts
    Member since:
    May 2013

    Posted 21 May 2013 Link to this post

    I can not seem to load the template it keeps failing.  

    Any suggestions?
  3. UI for WPF is Visual Studio 2017 Ready
  4. BishMan
    BishMan avatar
    11 posts
    Member since:
    May 2013

    Posted 21 May 2013 Link to this post

    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.

  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 24 May 2013 Link to this post

    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.

Back to Top