/// <summary> /// Updates the hover states of the rating items. /// </summary> private void UpdateHoverStates() { if (HoveredRatingItem != null && !IsReadOnly) { IList <RatingItem> ratingItems = GetRatingItems().ToList(); int indexOfItem = ratingItems.IndexOf(HoveredRatingItem); double total = ratingItems.Count(); double filled = indexOfItem + 1; this.DisplayValue = filled / total; for (int cnt = 0; cnt < ratingItems.Count; cnt++) { RatingItem ratingItem = ratingItems[cnt]; if (cnt <= indexOfItem && this.SelectionMode == RatingSelectionMode.Continuous) { VisualStates.GoToState(ratingItem, true, VisualStates.StateMouseOver); } else { IUpdateVisualState updateVisualState = (IUpdateVisualState)ratingItem; updateVisualState.UpdateVisualState(true); } } } else { this.DisplayValue = this.Value.GetValueOrDefault(); foreach (IUpdateVisualState updateVisualState in GetRatingItems().OfType <IUpdateVisualState>()) { updateVisualState.UpdateVisualState(true); } } }