Esempio n. 1
0
        private static void OnRatingDisplayPrecisionChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            RadRating rating = sender as RadRating;

            rating.UpdateDisplayValue();
            rating.UpdateFillRatio();
        }
Esempio n. 2
0
        private static void OnAutoGeneratedItemsCountChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            RadRating rating = sender as RadRating;

            if (!rating.IsTemplateApplied)
            {
                return;
            }

            if ((int)args.OldValue == 0 && rating.itemsSource.Count != 0)
            {
                throw new InvalidOperationException(AutoGeneratedItemsCountExceptionMessage);
            }

            rating.isItemsSourceChangedSilently = true;
            rating.itemsSource.Clear();
            int newValue = (int)args.NewValue;

            if (newValue <= 0)
            {
                rating.AutoGeneratedItemsCount = 0;
            }
            else
            {
                rating.GenerateRatingItems();

                double coercedValue = RadMath.CoerceValue(rating.Value, 0, rating.itemsSource.Count);
                if (rating.Value != coercedValue)
                {
                    rating.SetValuePropertySilently(ValueProperty, coercedValue);
                    rating.UpdateDisplayValue();
                    rating.UpdateFillRatio();
                }
            }

            rating.isItemsSourceChangedSilently = false;
            rating.PopulateRatingPanel();
        }
Esempio n. 3
0
        private static void OnRatingSelectionModeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            RadRating rating = sender as RadRating;

            rating.UpdateFillRatio();
        }