Appearance and Styling in .NET MAUI Rating (SfRating)

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;
public MainPage()
{
    InitializeComponent();
    rating = new SfRating();
    rating.ItemSize = 20;
}

SfRating Item Size customization

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;
public MainPage()
{
    InitializeComponent();
    rating = new SfRating();
    rating.ItemCount = 4;
}

Set number of rating items

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;
public MainPage()
{
    InitializeComponent();
    rating = new SfRating();
    rating.ItemSpacing = 20;
}

Space between rating items

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;
RatingSettings ratingSettings;
public MainPage()
{
    InitializeComponent();
    rating = new SfRating();
    ratingSettings = new RatingSettings();
    ratingSettings.RatedFill = Colors.Red;
    ratingSettings.UnratedFill = Colors.Gray;
    ratingSettings.UnratedStroke = Colors.Blue;
    ratingSettings.RatedStrokeThickness = 2;
    ratingSettings.UnratedStrokeThickness = 2;
    rating.RatingSettings = ratingSettings;
}

Rating Settings