Update: The demo above is converted to Silverlight 2 RC0. The only thing you have to change in order to run the code under Silverlight RC0 is to place the generic.xaml in a folder called "Themes" in the project of the voting control. Everything else is compatible with the release candidate.
During the progress of the Silverlight: Write and Win! contest - one has finished and in the end of September another one ended, we thought that it would be nice to create a simple Voting control in Silverlight that will host the poll for the articles in the contest. The custom control we've created is based on the ItemsControl and its items are also custom controls. The biggest advantage of this control is that it's independent on the type of the objects that you pass as ItemsSource. You just set which properties of your business object to be used as Text and as Value for the poll options. That way you don't have to change them according to the control. The control also has a simple progress bar that visualizes the percentage of the votes.
Source code
Note: The source code that is available for download is the one used for the article. To create this demo and the voting control for the site I made some modifications to it. The reason I post the basic source code is that you may want to make your own modifications to the control - like allowing multiple votes or only one time voting, modifying the user experience and the styling, adding total votes and poll title, customizing the workflow in the control etc. If you are interested in the things I have modified, I'll gladly share them with you, otherwise you can easily make your own modifications.
Read more ...