/// <summary> /// Sets up stars when Value or NumberOfStars properties change /// Will only show up to the number of stars requested (up to Maximum) /// so if Value > NumberOfStars * 1, then Value is clipped to maximum /// number of full stars /// </summary> /// <param name="ratingsControl"></param> private static void SetupStars(RatingsControl ratingsControl) { Decimal localValue = ratingsControl.Value; ratingsControl.spStars.Children.Clear(); for (int i = 0; i < ratingsControl.NumberOfStars; i++) { StarControl star = new StarControl(); star.BackgroundColor = ratingsControl.BackgroundColor; star.StarForegroundColor = ratingsControl.StarForegroundColor; star.StarOutlineColor = ratingsControl.StarOutlineColor; if (localValue > 1) star.Value = 1.0m; else if (localValue > 0) { star.Value = localValue; } else { star.Value = 0.0m; } localValue -= 1.0m; ratingsControl.spStars.Children.Insert(i, star); } }