The RatingIndicator control is used to let the user do some rating on a certain topic. The graphical control displayes some stars, and the more stars are marked by the user via mouse hovering, the higher the rating is. This is the interactive purpose of the control. Alternatively, it can be used to display some rating values to users, as for example known from hotel booking sites where each hotel got a rating, and the RatingIndicator now shows the average of all the ratings made in the past.
In the following example, the RatingIndicator control shows the average of already existing ratings. The visualization mode can be switched between full stars, half stars and continuous. The user can also rate, but only once in this example. After the rating, the values are updated, and the control is set to read-only mode.
Note that is is also possible to use custom icons. For this, you would store three icons for the states selected
, unselected
,
and hovered
via the corresponding control properties.
In non-read-only mode it is possible to increase and decrease the values via the Arrow left
and right
keys step by step;
and using the keys Pos1
and end
, you can directly jump to value 1 or max.
Escape
cancels the modifications. With space
or Enter
, a modification is stored.
The RatingIndicator control implements the ARIA role slider.