views:

44

answers:

0

Hi,

I'm using Silverlight 3 and I have a dropdown menu which is used to filter four listboxes. These listboxes are individually wrapped within a ListBoxDragDropTarget (from the silverlight toolkit).

The idea being that a user can see all available items or filter their view (all four listboxes) by a specific category.

One listbox shows available items that can be assigned and then a user can drag from this list to one of the other three (which indicate what they want to do with the selected item. items can also be dragged across these three lists).

Everything works well until you use a filter and then drag an item onto a listbox which is empty (as a result of the filter).

The error I get is below and it is thrown when the item is being 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.<.ctor>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 come across a similar error. Is PagedCollectionView (which is passed an observable collection) the wrong way of going about this?

Any insight from someone who's come across this would be appreciated.

Cheers!

John