Wednesday, August 06, 2008

A Customizable Silverlight Star Selector Control

I thought I would post the source code for a control that I typically demonstrate at my Silverlight presentations.  I usually show this control at the end of my presentation, so I never really get to talk about the control as much as I like. 

As you can probably infer from the image below, this control presents 4 stars/hearts/whatever and, by hovering your mouse over the control, you can change the state of the control.  Clicking on a particular star will set the rating for the selector. I think this screenshot really illustrates the awesome skinning capabilities of Silverlight.  Keep in mind, I built these control skins myself in very little time and I have no formal training in artistic design.  All of the skins are vectors and can be resized as required.  Also, since the control logic is encapsulated, creating a new skin does not require you to dive down into the code!

stars

I'd appreciate your feedback on the control.  I'm sure there are a lot of features I could add.  The source code and a live demo have been provided below.  Enjoy!

View Live Demo

Download Source Code