Dec 10, 2009 at 2:58 PM
Edited Dec 10, 2009 at 3:15 PM
|
Here is the calender styles for expression dark, this took me a full day to do!!!, so microsoft cop on and update the themes.As much as microsoft would like us to think that you can simply cut and paste silverlight code into wpf and vice versa, its just
not true yet.
These styles were achieved by taking the corresponding silverlight styles and replacing sections of xaml to match the syntax of the generic.xaml here and there. You should find the generic.xaml in the Toolkit-release\Calendar\Themes in your extracted
download of the WPFToolkit.
I also found some help from this website http://msdn.microsoft.com/en-us/magazine/dd882520.aspx and the related code available here http://code.msdn.microsoft.com/mag200906Foundations/Release/ProjectReleases.aspx?ReleaseId=2614.
The last thing that was required, after plugging in the sections from generic.xaml, and this was one of the most important steps, you need to tell the calender style to use the defined styles of all the other calender elements. First you need to set a x:Key
property on the other styles so you can reference them and then in the calendar style you will see
<Setter Property="CalendarDayButtonStyle" Value= "{DynamicResource CalDay}"/>
<Setter Property="CalendarButtonStyle" Value= "{DynamicResource CalBut}"/>
and
<primitives:CalendarItem
Name="PART_CalendarItem"
Style = "{DynamicResource CalItem}"....
Without these lines, the CalendarItem, CalendarDayButton and CalendarButton styles are just a waste of space and will not take effect. These changes were strangely missing from the generic.xaml and the silverlight theme.
You must have these namespaces declared. If you compare the silverlight expressiondark theme to the code below you will see I simple changed the namespace for the calendar elements. This was the simplest part, and I'm sure many of you have got this far already.
xmlns:vsm="clr-namespace:System.Windows;assembly=WPFToolkit"
xmlns:controls="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
xmlns:primitives="clr-namespace:Microsoft.Windows.Controls.Primitives;assembly=WPFToolkit"
I have uploaded my full expressiondark theme here http://rapidshare.com/files/318980080/ExpressionDark2.xaml as even just including the calender related snippets here exceeds the message lenght restriction. I have made other changes to the theme which you
may not want, so copy just the calendar bits from the xaml file which are at the bottom into your expressiondark.xaml.
Just a extra note: Because the expressiondark and expressionlight are essentially the same code with different colors behind the resources, you can drop these new styles as is into the expressionlight also.
|