For this situaliton Silverlight Contrib using StarSelector control. Using this control is very simple. You just set the basic properties such as Whidth, Height, Name and than you work with event RatingChanged.
Before we start, in case you do not know how to add Silverlight Contrib libraries to your project, read my first post.
We could make small example. So I would like that TextBlock said me my rating.
XAML:

C#

Result:
Ok, that was quite easy. Let's go to do something much more funnier. I have an other example. I have a some data, for example database of cars. And one of my attributes is rating. And I wont to show my data in DataGrid and use for rating column StarSelector.
So, I have a class Car.cs:

Here is my DataGrid:

And this is some dunny data filler:

Result:
That's it. Have a fun with Silverlight Contrib StarSelector control.
In following post about Silverlight Contrib I would like to show you how to customize StarSelector.




3 comments:
Is there anyway to do a 5 star rating? Just thinking most people use either a 3 star or 5 star rating system.
That is very good question. Really. But the answer is not so good (for this moment). Unfortunately if you want change a number of stars you probably must go to the source code of this control. The problem is that there are no show cases where it is.
So be patient.
I'm actually rewriting this control for Silverlight Contrib. In the next release, you should be able to specify the number of stars. Additionally, you will be able to enable half-star selection. Later!
Post a Comment