Customizing appearance

8 May 2019 / 2 minutes to read

You can customize the color, stroke width, and stroke color of rated and unrated items using the following properties of SfRatingSettings:

  • RatedFill
  • UnRatedFill
  • RatedStroke
  • UnRatedStroke
  • RatedStrokeWidth
  • UnRatedStrokeWidth

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;

Rated Items

Unselected items

The UnRatedFill property fills the unrated area with the specified solid color in the SfRating control.

ratingSettings.UnRatedFill = Color.Gray;

Unrated Items

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;

Rated Item Stroke Color

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;

Unrated Item Stroke Color

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;

Rated Item Stroke Width

Unselected items

The UnRatedStrokeWidth property sets the stroke width for the unrated area with the specified value in the SfRating control.

ratingSettings.UnRatedStrokeWidth = 3;

Unrated Item Stroke Width