Scheduler for WPF | ComponentOne
Using the C1Calendar Control / C1Calendar Themes / Setting the Calendar Theme
In This Topic
    Setting the Calendar Theme
    In This Topic

    All calendar controls use the current system theme, by default. If you want to use a different theme, there are several ways to select a new one.

    To set the theme at design time in Visual Studio:

    1. Right-click the control.
    2. Select Theme and choose one of the seven predefined themes.
    Note:You can also change the theme through the Properties window by selecting the option from the drop-down list next to the CalendarBase.Theme property.

    To set the theme in Microsoft Blend, change the CalendarBase.Theme property at design time:

    1. Select the C1Calendar control in your XAML window or page.
    2. In the Properties panel, under Appearance, click the drop-down arrow next to the CalendarBase.Theme property and choose one of the predefined themes.

    To set the theme using the ResourceID, use the following XAML:

     

    XAML
    Copy Code
    <my:C1Calendar x:Name="calendar1" MaxSelectionCount="14"
    Theme="{DynamicResource {ComponentResourceKey
    TypeInTargetAssembly=my:CalendarBase, ResourceId= MediaPlayer}}"/>
    

       

    To set the theme using C1CalendarResources static fields, add the following code to your project:

    Visual Basic
    Copy Code
    calendar.Theme = C1CalendarResources.MediaPlayer
    

     

    C#
    Copy Code
    calendar.Theme = C1CalendarResources.MediaPlayer;
    

     

    To set the theme by defining a ResourceDictionary and DefaultThemeKey in your Page, Window, or Application resources:

    XAML
    Copy Code
    <Page.Resources>
               <ResourceDictionary>
    <ResourceDictionary x:Key="{x:Static my:CalendarBase.DefaultThemeKey}"
    Source="/C1.WPF.C1Schedule;component/themes/CalendarThemes/MediaPlayer/MediaPlayer.xaml" />
               </ResourceDictionary.MergedDictionaries>
         </Page.Resources>
    

        

    Note that this will affect all controls in the current scope.

    You can also create your own theme ResourceDictionaries and use them with the calendar controls.

    The best way to customize one of the predefined themes is to include the default theme definition in a custom ResourceDictionary and redefine necessary resources, such as theme brushes, there.

    Note: To ensure all default styles and templates continue to work correctly during customization, it is suggested that the resource keys are not changed from their default settings.