SIGN UP MEMBER LOGIN:    
ARTICLE

Rating Control in WPF Toolkit

Posted by Diptimaya Patra Articles | WPF March 09, 2010
Rating Control is introduced in WPF Toolkit February 2010 release. In this article we will see how we can use the Rating Control.
Reader Level:
Download Files:
 

Introduction

Rating Control is introduced in WPF Toolkit February 2010 release. In this article we will see how we can use the Rating Control.

Crating WPF Application Project

Fire up Visual Studio 2008 and Create a WPF Application and name the project as RatingInWPF.

image1.gif

We can add the rating control by adding the following DLL from WPF Toolkit directory.

image2.gif

Or, we can add it in Expression Blend.

image3.gif

After adding the Rating control add few RatingItem Controls. Suppose we need to rate out of 5 then add 5 RatingItems.

image4.gif

By default a Content comes with Rating Item control, remove the content value.

The following figure shows the hierarchy in object and timeline pane.

image5.gif

Now we will use the Rating Control to rate Movies displayed in a list and store it.

So let's create some sample Data and Bind it to ListBox.

image6.gif

Above Class represents our Movie Structure.

image7.gif

As you see in above code display, we have used ObservableCollection, because in run time we would be seeing what value we have stored for each Movie.

image8.gif

Above code display shows the DataTemplate for our Data to be bound.

Now run the application we would test the ListBox with Sample data.

image9.gif

Now we will have two events one from RatingControl and another from ListBox such as follows, and add the below code in respective event handlers.

image10.gif

The highlighted code has to be entered in the Constructor, for some reason the event cannot be created in XAML.

That's it; we are ready to test our application.

image11.gif

As we are using ObservableCollection the change in the Collection is instantly affected. So changning the Rating Value will change in the Collection.

Hope this article helps.

share this article :
post comment
 

bcvbcbcbcb

Posted by vicky kaushal Apr 28, 2011
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Team Foundation Server Hosting
Become a Sponsor