Appearance and Styling
14 Jun 20191 minute to read
When the default view is not needed, you can customize the view of Xamarin.iOS SfRating control. The SfRating control provides support to customize the size, item count, and space between rating items.
Set Size
The ItemSize
property sets the size of the rating items.
NOTE
By default, property value is 50.
rating.ItemSize = 20;
Set Number of Items
The ItemCount
property sets the number of rating items to be displayed.
NOTE
The default property value is 5.
rating.ItemCount = 4;
Set Space between Items
The ItemSpacing
property sets the spacing between the rating items.
NOTE
By default, property value is 5.
rating.ItemSpacing = 20;
Rating Settings
For styling customization, set the RatingSettings property value with SfRatingSettings object instance.
SfRating rating;
SfRatingSettings ratingSetings;
public override void ViewDidLoad()
{
base.ViewDidLoad();
rating = new SfRating();
ratingSettings = new SfRatingSettings();
ratingSettings.RatedFill = UIColor.Red;
ratingSettings.UnRatedFill = UIColor.Blue;
ratingSettings.RatedStrokeWidth = 5;
ratingSettings.UnRatedStrokeWidth = 3;
rating.RatingSettings = ratingSettings;
}