How can I help you?
Customizing appearance
17 Jan 20252 minutes to read
You can customize the color, stroke width, and stroke color of rated and unrated items using the following properties of SfRatingSettings:
RatedFillUnRatedFillRatedStrokeUnRatedStrokeRatedStrokeWidthUnRatedStrokeWidth
Rating settings
For customizing styles, set the value of RatingSettings property with SfRatingsSettings object instance.
SfRating rating;
SfRatingSettings ratingSettings;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
rating = new SfRating(this);
ratingSettings = new SfRatingSettings();
rating.RatingSettings = ratingSettings;
}Set fill color
The SfRating control supports to set the fill color for the selected and unselected items.
Selected items
The RatedFill property fills the rated area with the specified solid color in the SfRating control.
ratingSettings.RatedFill = Color.Red;
Unselected items
The UnRatedFill property fills the unrated area with the specified solid color in the SfRating control.
ratingSettings.UnRatedFill = Color.Gray;
Set stroke color
The SfRating control supports to set the stroke color for the selected and unselected items.
Selected items
The RatedStroke property sets the stroke for the rated area with the specified solid color for the selected items in the SfRating control.
ratingSettings.RatedStroke = Color.DarkGreen;
Unselected items
The UnRatedStroke property sets the stroke for the unrated area with the specified solid color in the SfRating control.
ratingSettings.UnRatedStroke = Color.Black;
Set stroke width
The SfRating control supports to set the stroke width for the selected and unselected items.
Selected items
The RatedStrokeWidth property sets the stroke width for the rated area with the specified value in the SfRating control.
ratingSettings.RatedStrokeWidth = 3;
Unselected items
The UnRatedStrokeWidth property sets the stroke width for the unrated area with the specified value in the SfRating control.
ratingSettings.UnRatedStrokeWidth = 3;