Infosys Microsoft Alliance and Solutions blog

« Handling Thread Exceptions | Main | Configuring WCF on IIS 7 »

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

  1. 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
  2. I then added RainierOrange and ShinyRed to 2 columns in my Grid and then further child controls inside of these theme controls.
  3. 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.
  4. 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]"
  5. 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.
  6. 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.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Please key in the two words you see in the box to validate your identity as an authentic user and reduce spam.

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter