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

Style for DatePicker

1 Answer 174 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Dan M
Top achievements
Rank 1
Dan M asked on 07 Mar 2011, 07:18 PM
I am trying to apply a Theme to the DatePicker control but I also want to hide the week numbers in the calendar pop-up. This is the code

<Window x:Class="WPF_RadDateTimePicker.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:local="clr-namespace:WPF_RadDateTimePicker"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <Style x:Key="calendarStyle" TargetType="telerik:RadCalendar">           
            <Setter Property="AreWeekNumbersVisible" Value="False" />
        </Style>
    </Window.Resources>
 
    <StackPanel>        
        <telerik:RadDateTimePicker Width="100" VerticalAlignment="Center"
                                   CalendarStyle="{StaticResource calendarStyle}"
                                   telerik:StyleManager.Theme="Expression_Dark"/>
    </StackPanel>
</Window>

As soon as I reffer to the static calendarStyle the Expression_Dark theme is no longer correctly applied to the Calendar control
otherwise works fine. How can I fix this?? ( I using 2010 Q3 version of the product)

1 Answer, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 11 Mar 2011, 08:58 AM
Hello Dan,

You will need to base your CalendarStyle on the Expression theme to prevent the style from overriding the theme. Use the ThemeResourceKey as follows:

<Style x:Key="CalendarStyle" TargetType="telerik:RadCalendar" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:Expression_DarkTheme, ElementType=telerik:RadCalendar}}">           
          <Setter Property="AreWeekNumbersVisible" Value="False" />
</Style>


Regards,
Dani
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
DatePicker
Asked by
Dan M
Top achievements
Rank 1
Answers by
Dani
Telerik team
Share this question
or