New to Telerik UI for WPFStart a free 30-day trial

In Code-Behind

Updated on Oct 1, 2025

This tutorial will walk you through the common tasks of adding and removing RadRatingItems programmatically.

XAML
	<telerik:RadRating x:Name="radRating"/>

Figure 1: Result from Example 1

RadRating

Adding RadRatingItems

In order to add new rating items to a RadRating control, you have to perform several simple steps:

  • Create an instance of the RadRatingItem class

  • Set its properties such as Content if you need so

  • Add it to the RadRating's Items collection

    C#
    	RadRatingItem ratingItem = new RadRatingItem();
    	this.radRating.Items.Add(ratingItem);

Figure 2: Result from Example 2

RadRating

In order to clear the default rating items and add new you have to add one additional step to the previous:

  • Clear the Items collection of the RadRating control

  • Create an instance of the RadRatingItem class

  • Set its properties such as Content if you need so

  • Add it to the RadRating's Items collection

C#
	this.radRating.Items.Clear(); 
	RadRatingItem ratingItem = new RadRatingItem();
	ratingItem.Content = "1";
	this.radRating.Items.Add(ratingItem);
	ratingItem = new RadRatingItem();
	ratingItem.Content = "2";
	this.radRating.Items.Add(ratingItem);

Figure 3: Result from Example 3

RadRating

Consider declaring rating items in XAML instead of adding them by code whenever it's possible. This includes situations when you know what items you need at design time.

Removing RadRatingItems

In order to remove a specific RadRatingItem, you should remove it from the RadRating's Items collection.

C#
	private void RemoveRatingItem( RadRatingItem itemToRemove )
	{
	   this.radRating.Items.Remove( itemToRemove );
	}