Silverlight Theming
If you have been following updates on Silverlight (SL) 2, you would already be aware of SL 2 Toolkit on codeplex. Scott in his blog has shared some amazing numbers on usage of SL and also given some indicators to where SL is headed in its next version.
I had been away from SL for some time due to other focus areas. However I decided to try my hands on the support for themes, a feature added with SL Toolkit.
This intro by Jesse Liberty amazed me. The theme seemed so trivial to use. The basic idea on these being available as controls that I could drop on my form and embed other controls inside of it was amazing. I decided to give this a try and started with my sample application. While building this, I observed a few things, which I wanted to capture and share
- To work with themes, I started by adding necessary references
- Microsoft.Windows.Controls.Theming.dll
- Microsoft.Windows.Controls.Theming.ExpressionDark.dll
- Microsoft.Windows.Controls.Theming.ExpressionLight.dll
- Microsoft.Windows.Controls.Theming.RainierOrange.dll
- Microsoft.Windows.Controls.Theming.RainierPurple.dll
- Microsoft.Windows.Controls.Theming.ShinyBlue.dll
- Microsoft.Windows.Controls.Theming.ShinyRed.dll
- I then added RainierOrange and ShinyRed to 2 columns in my Grid and then further child controls inside of these theme controls.
- After I added the child controls, I expected them to display using the parent theme, but that didn't happen till the time I built the project once. I guess that caused the designer to refresh and load the theme assemblies appropriately.
- I then also added Microsoft.Windows.Controls.dll to add some new controls from the toolkit and when I tried to debug I got an error - "Invalid attribute value input:ButtonSpinner for property TargetType. [Line: 1 Position: 220]"
- Doing some online search pointed that need to also add reference to Microsoft.Windows.Controls.Input.dll and Microsoft.Windows.Controls.DataVisualization.dll. Interestingly, this error is seen when I debug the solution. If I run it without debugging, it works fine.
- If you add only one of the assemblies, you might end up seeing an error like this - "Invalid attribute value charting:Chart for property TargetType. [Line: 1 Position: 262]". Hence it will be good to add reference to both the assemblies mentioned in the previous point
I am surprised why debug execution gives an error while run doesn't (point 5). If anyone has found out a reason, please share.
