How can I help you?
Appearance and Styling in .NET MAUI Rating (SfRating)
21 Apr 20252 minutes to read
When the default view is not needed, you can customize the view of .NET MAUI SfRating control. The SfRating control provides support to customize the item 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:SfRating ItemSize="20" />SfRating rating = new SfRating();
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:SfRating ItemCount="4" />SfRating rating = new SfRating();
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:SfRating ItemSpacing="20" />SfRating rating = new SfRating();
rating.ItemSpacing = 20;
Rating Settings
This section explains about various rating settings available in the SfRating control.
<rating:SfRating Value="3">
<rating:SfRating.RatingSettings>
<rating:RatingSettings RatedFill="Red" UnratedFill="Gray"
UnratedStroke="Blue" RatedStrokeThickness="2" UnratedStrokeThickness="2"/>
</rating:SfRating.RatingSettings>
</rating:SfRating>SfRating rating = new SfRating();
RatingSettings ratingSettings = new RatingSettings()
{
RatedFill = Colors.Red,
UnratedFill = Colors.Gray,
UnratedStroke = Colors.Blue,
RatedStrokeThickness = 2,
UnratedStrokeThickness = 2
};
rating.RatingSettings = ratingSettings;