private void HandleItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (!this.IsTemplateApplied || this.isItemsSourceChangedSilently) { return; } if (!this.IsItemsSourceManual) { throw new InvalidOperationException(ItemsCollectionChangedExceptionMessage); } switch (e.Action) { case NotifyCollectionChangedAction.Add: this.AddItemOnCollectionChanged(e.NewItems[0] as RadRatingItem, e.NewStartingIndex); break; case NotifyCollectionChangedAction.Remove: this.RemoveItemOnCollectionChanged(e.OldStartingIndex); break; case NotifyCollectionChangedAction.Reset: this.ResetItems(); break; case NotifyCollectionChangedAction.Move: this.MoveItemOnCollectionChanged((uint)e.OldStartingIndex, (uint)e.NewStartingIndex); break; case NotifyCollectionChangedAction.Replace: RadRatingItem oldItem = e.OldItems[0] as RadRatingItem; RadRatingItem newItem = e.NewItems[0] as RadRatingItem; this.ReplaceItemsOnCollectionChanged(oldItem, newItem); break; } }
internal int GetIndexOf(RadRatingItem ratingItem) { return(this.itemsSource.IndexOf(ratingItem)); }