Custom theme for ScheduleView

2 posts, 0 answers
  1. Alexander
    Alexander avatar
    2 posts
    Member since:
    Nov 2011

    Posted 23 Nov 2011 Link to this post

    Hi,

    I'm using trial version of Telerik WPF controls (Q3 2011) and trying to create my own theme for ScheduleView using following article as a guide Creating a Custom Theme Project (I know it is written for Silverlight control but I can't find something similar for WPF)
    I used SchedulerView.xaml from OfficeBlue theme as a starting point for my modification. And it looks like I almost successfully applied my custom theme to the RadScheduleView controls. My problem is that some "parts" of the control are missing in the custom theme, you can see it on the screenshot attached bellow.
    It is obvious I'm doing something wrong but I can't figure out what is exactly wrong, so could you please help me with it.

    Here is the link to my demo project http://dl.dropbox.com/u/3950376/TelerikScheduleView.zip (I don't know how to attach zip files to my message here)

    Thanks,
    Alexander
  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 28 Nov 2011 Link to this post

    Hi Alexander,

    Thank you for your project.

    The problem with the DateTimePicker comes from the fact that RadCalendar cannot find its theme. By default RadCalendar is set a Theme via the telerik:StyleManager.Theme="{StaticResource Theme}". But after you changed that StaticResource to your custom theme, RadCalendar control cannot be displayed, because your custom theme does not contain a Style for it.

    You can apply a workaround to this problem quite easily. Simply set the Office_Blue theme directly to RadCalendar:

    <Style x:Key="NavigationDateTimePickerStyle" TargetType="telerik:RadDatePicker">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerik:RadDatePicker">
                        <telerik:RadDropDownButton Style="{StaticResource NavigationCalendarToggleButton}" DropDownIndicatorVisibility="Collapsed" 
                                                   IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                            <telerik:RadDropDownButton.DropDownContent>
                                  
                                <telerik:RadCalendar x:Name="PART_Calendar" IsReadOnly="{TemplateBinding IsReadOnly}" 
                                                     DateSelectionMode="{TemplateBinding DateSelectionMode}"
                                                     Culture="{TemplateBinding Culture}" SelectionMode="Single" 
                                                     DisplayDateStart="{TemplateBinding DisplayDateStart}" 
                                                     DisplayDateEnd="{TemplateBinding DisplayDateEnd}" 
                                                     SelectableDateStart="{TemplateBinding SelectableDateStart}" 
                                                     SelectableDateEnd="{TemplateBinding SelectableDateEnd}" 
                                                     DisplayDate="{Binding DisplayDate, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" 
                                                     SelectedDate="{Binding SelectedDate, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" 
                                                     telerik:StyleManager.Theme="Office_Blue"/>
                              
                            </telerik:RadDropDownButton.DropDownContent>
                        </telerik:RadDropDownButton>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    Please, keep in mind that this may happen with other controls that does not have a Style in your custom theme, too.

    I hope this will be helpful.

    Best wishes,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top