/// <summary> /// Returns the item at the specified zero-based index in this view. /// </summary> /// <param name="index">The zero-based index at which the item is located.</param> /// <returns>The item at the specified zero-based index in this view.</returns> public override Object GetItemAt(Int32 index) { // Make sure the index is within range. For performance reasons there is no check for the upper bounds of an IEnumerable collection. if (index < 0) { throw new ArgumentOutOfRangeException("index"); } // See if we can extract an item from a collection view. CollectionView collectionView = this.currentView as CollectionView; if (collectionView != null) { return(collectionView.GetItemAt(index)); } // See if there is a ViewableCollection class that can be used to return the number of items in the collection. ViewableCollection viewableCollection = this.currentView as ViewableCollection; if (viewableCollection != null) { return(viewableCollection.GetItemAt(index)); } // At this point, we can't extract an item from the current collection view. return(null); }
///// <summary> ///// ///// </summary> ///// <param name="notifyCollectionChangedEventArgs"></param> //protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs) //{ // if (this.CollectionChanged != null) // this.CollectionChanged(this, notifyCollectionChangedEventArgs); // base.OnCollectionChanged(notifyCollectionChangedEventArgs); //} /// <summary> /// Returns a value that indicates whether the specified item belongs to this view. /// </summary> /// <param name="item">The object to test.</param> /// <returns>true to indicate that the specified item belongs to this view or there is no filter set on this collection view; otherwise, false.</returns> public override Boolean PassesFilter(Object item) { // Test whether the value in the inner collection can pass the filters placed on it. CollectionView collectionView = this.currentView as CollectionView; if (collectionView != null) { return(collectionView.PassesFilter(item)); } // See if there is a ViewableCollection class that can be used to return the number of items in the collection. ViewableCollection viewableCollection = this.currentView as ViewableCollection; if (viewableCollection != null) { return(viewableCollection.PassesFilter(item)); } // If there is no class available to check the filter, then the filter operation will fail. return(false); }