I mentioned a few weeks ago that Corrina Barber is creating some elegant skins that I will be using for my samples in my upcoming book Silverlight 2 with Data Access. Corrina has updated quite a bit with the templates due to the changes from beta 1 to beta 2, throw in some minor tweaks that I am making to them, and they are coming along quite well for the book.

One of the changes I began making is creating a way to have a base color that all the control’s skins can use. For example, Corrina has done a fantastic job making some elegant style templates for the Silverlight controls. The controls were originally written to be in the red spectrum of colors. I wanted to make them use a shade of blue as they base color. So all I had to do was go into the templates and create a single resource for the SolidBrushColor for the shade of blue I wanted and then bind each of the style templates that Corrina created to that resource. For example, in App.xaml I added this resource:

        <SolidColorBrush x:Key="BaseColorBrush" Color="#FF00135B"/>

Then I referred to this resource from the styles in app.xaml, like this:

<!--Button Style-->
<vsm:Style x:Key="ButtonStyle" TargetType="Button">
    <vsm:Setter Property="Background" Value="{StaticResource BaseColorBrush}"/>
    <vsm:Setter Property="Foreground" Value="#FFFFFFFF" />

Every style in app.xaml refers to this base color at one or more locations.


This works out great since I want all of the styles for all of the controls to hang off this base color. And if you want to use a different shade of blue or even a different base color like green, purple, or yellow you just change the base SolidColorBrush resource. One of my favorite things about Silverlight development is that Blend and the Visual State Manager tools make it easy for a non graphically inclined developer like myself to actually create slick looking styles. Its a very cool thing!

Corrina is going to post some information on her skins and share some tips on how she created them using Blend and the new Visual State Manager tools. So definitely look out for her posts.