Using PagedCollectionView for four ListBoxes that support drag and drop = Index Errors When Applying a Filter

I am using Silverlight 3 and I have a drop-down menu that is used to filter four lists. These lists are individually wrapped in a ListBoxDragDropTarget (from the silverlight toolbox).

The idea is that the user can see all the available elements or filter their presentation (all four lists) by a specific category.

One list displays the available items that can be assigned, and then the user can drag from this list to one of the other three (indicating what they want to do with the selected item. You can also drag items through these three lists).

Everything works well until you use the filter, and then drag the item to the empty list (as a result of the filter).

The error I get is below and it gets called when the item is removed from the original list.

Specified argument was out of the range of valid values.
Parameter name: index

   at System.Windows.Data.PagedCollectionView.GetItemAt (Int32 index)
   at System.Windows.Data.PagedCollectionView.get_IsCurrentInSync ()
   at System.Windows.Data.PagedCollectionView.AdjustCurrencyForRemove (Int32 index)
   at System.Windows.Data.PagedCollectionView.ProcessRemoveEvent (Object removedItem, Boolean isReplace)
   at System.Windows.Data.PagedCollectionView.ProcessCollectionChanged (NotifyCollectionChangedEventArgs args)
   at System.Windows.Data.PagedCollectionView.b__0 (Object sender, NotifyCollectionChangedEventArgs args)
   at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke (Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged (NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.RemoveItem (Int32 index)
   at System.Collections.ObjectModel.Collection`1.RemoveAt (Int32 index)

Has anyone encountered a similar error. Is a PagedCollectionView (which skips the observed collection) the wrong way around this?

Any insight into whoever comes across this will be appreciated.

+3
source share

Source: https://habr.com/ru/post/1758186/


All Articles