Last Updated: 03 Jan 2017 20:56 by ADMIN
Martin Ivanov
Created on: 25 Apr 2014 07:06
Category: Rating
Type: Bug Report
Rating: NumberOfItemsToGenerate property doesn't work when the rating is in a separate UserControl and the property is data bound
When the RadRating is defined in a separate UserControl with a custom property (for example MaxRating) and its NumberOfItemsToGenerate property is bound to the custom property, the number of the generated items is not correct. The value of the custom property (MaxRating) is ignored.

As a workaround you can bind the ItemsSource property of the rating control to the MaxRating property. Then with a converter create a new empty collection with length set to the value of the MaxRating property.
<telerik:RadRating ItemsSource="{Binding MaxRating, RelativeSource={RelativeSource AncestorType=UserControl}, Converter={StaticResource ratingToItemsSourceConverter}}" />

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    return new object[(int)value];