Precision Mode in .NET MAUI Rating (SfRating)
21 Jul 20263 minutes to read
Prerequisites
Before using the SfRating, ensure the following NuGet package is installed in your .NET MAUI project:
Syncfusion.Maui.Inputs
For step-by-step setup, refer to the Getting Started documentation.
Overview
The Precision mode defines the accuracy level of the .NET MAUI Rating control. It has Standard, Half, and Exact options. The default precision mode of the Rating control is Standard.
The following table summarizes the available precision modes and their typical use cases.
| Precision mode | Allowed increments | Typical use case |
|---|---|---|
Standard |
Whole values (e.g., 1, 2, 3) | Simple whole-star ratings such as product or movie ratings. |
Half |
Half values (e.g., 0.5, 1.5, 2.5) | Ratings that allow half-step granularity, such as service feedback. |
Exact |
Any fractional value (e.g., 2.3, 3.7) | Ratings that require precise or continuous feedback, such as analytics. |
Standard
When the precision mode of Rating is set as Standard, rating items are filled completely based on the rating value. Only whole values are accepted; fractional values are rounded to the nearest whole number.
<rating:SfRating Value="3"
Precision="Standard" />SfRating rating = new SfRating()
{
Value = 3,
Precision = Precision.Standard
};
Half
When the precision mode of Rating is set as Half, rating items are filled up to half of an item based on the rating value. Half values (for example, 0.5, 1.5, 2.5) are accepted, allowing partial fills of rating items.
<rating:SfRating Value="2.5"
Precision="Half" />SfRating rating = new SfRating()
{
Value = 2.5,
Precision = Precision.Half
};
Exact
When the precision mode of Rating is set as Exact, rating items are filled precisely to match the exact rating value. Fractional values (for example, 3.7) are accepted and rating items are filled to the proportional amount.
<rating:SfRating Value="3.7"
Precision="Exact" />SfRating rating = new SfRating()
{
Value = 3.7,
Precision = Precision.Exact
};