New to Telerik UI for WPF? Download free 30-day trial

Declaratively

This tutorial will walk you through the common task of populating RadRating with RadRatingItems declaratively.

Example 1 demonstrates a regular RadRating declaration, where telerik points to: <xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" />

Example 1: Declare a RadRating

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

Figure 1: Result from Example 1

RadRating

In order to add rating items you need to use the RadRating's Items property. The Items property is an ItemCollection which contains your RadRatingItems. Example 2 shows how to add RadRatingItems to your RadRating.

Example 2: Adding RadRatingItems

<telerik:RadRating x:Name="radRating"> 
    <telerik:RadRatingItem Content="1" /> 
    <telerik:RadRatingItem Content="2" /> 
    <telerik:RadRatingItem Content="3" /> 
    <telerik:RadRatingItem Content="4" /> 
    <telerik:RadRatingItem Content="5" /> 
    <telerik:RadRatingItem Content="6" /> 
    <telerik:RadRatingItem Content="7" /> 
    <telerik:RadRatingItem Content="8" /> 
    <telerik:RadRatingItem Content="9" /> 
    <telerik:RadRatingItem Content="10" /> 
</telerik:RadRating> 

Figure 2: Result from Example 2

RadRating with RadRatingItems

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.

In this article