Scheduler Components and Controls > Scheduler for Silverlight Appearance > C1Scheduler WPF Themes > Creating a Custom Theme > Creating the Theme Pack |
To create your own theme pack, create a new Visual Studio 2008 project and include one or more theme ResourceDictionaries.
XAML |
Copy Code
|
---|---|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:C1.WPF.Schedule;assembly=C1.WPF.Schedule" xmlns:storage="clr-namespace:C1.C1Schedule;assembly=C1.WPF.Schedule" xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="PresentationOptions"> |
XAML |
Copy Code
|
---|---|
<ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/C1.WPF.C1Schedule;component/themes/SchedulerThemes/Office2007/Blue.xaml" /> </ResourceDictionary.MergedDictionaries> |
XAML |
Copy Code
|
---|---|
<SolidColorBrush x:Key="AlternateMonthBrush" Color="#08FFFFFF" PresentationOptions:Freeze="true"/> <SolidColorBrush x:Key="AllDayAreaBrush" Color="#11FFFFFF" PresentationOptions:Freeze="true"/> <SolidColorBrush x:Key="Background" Color="#FF111111" PresentationOptions:Freeze="true"/> <SolidColorBrush x:Key="BorderBrush" Color="#000B0B0B" PresentationOptions:Freeze="true"/> <SolidColorBrush x:Key="WorkHourBrush" Color="#FF303030" PresentationOptions:Freeze="true"/> |
XAML |
Copy Code
|
---|---|
<!-- determines the style of the month grid header (week day names) --> <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:C1Scheduler}, ResourceId=MonthHeaderStyle}" TargetType="{x:Type ContentControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ContentControl}"> <Grid> <Border BorderThickness="0,0,1px,0" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:C1Scheduler}}, Path=Theme[ControlAreaLinesBrush]}" SnapsToDevicePixels="True" Background="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:C1Scheduler}}, Path=Theme[ControlAreaBrush]}" /> <ContentPresenter TextBlock.Foreground="Red" Margin="0,2,0,2" Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> |
xmlns:local="clr-namespace:C1.WPF.Schedule;assembly=C1.WPF.Schedule"
XAML |
Copy Code
|
---|---|
<ResourceDictionary x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:C1Scheduler}, ResourceId=MyTheme}" Source="/C1SchedulerThemePack;component/themes/MyTheme.xaml" /> |
Tip: If you want to create a theme with a number of colors, such as Office 2007 Blue, Silver and Black, place the full theme definition into a single file and use this for one color. Then add this file as a merged resource dictionary into the ResourceDictionaries for the other colors, and redefine the colors (Brush resources) only. Create ComponentResourceKeys for each color in the generic.xaml file. |