In Code-Behind
This tutorial will walk you through the common tasks of adding and removing RadRatingItems programmatically.
<telerik:RadRating x:Name="radRating"/>
Figure 1: Result from Example 1

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

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
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

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.
private void RemoveRatingItem( RadRatingItem itemToRemove )
{
this.radRating.Items.Remove( itemToRemove );
}