コード例 #1
0
ファイル: RadRating.cs プロジェクト: tralivali1234/UI-For-UWP
        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;
            }
        }
コード例 #2
0
ファイル: RadRating.cs プロジェクト: zyhong/UI-For-UWP
 internal int GetIndexOf(RadRatingItem ratingItem)
 {
     return(this.itemsSource.IndexOf(ratingItem));
 }