使用PagedCollectionView为四个ListBoxes支持拖放=应用过滤器时的索引错误

时间:2010-08-05 10:42:37

标签: silverlight silverlight-3.0

我正在使用Silverlight 3,我有一个下拉菜单,用于过滤四个列表框。这些列表框分别包含在ListBoxDragDropTarget中(来自silverlight工具包)。

用户可以查看所有可用项目或按特定类别过滤其视图(所有四个列表框)。

一个列表框显示可以分配的可用项目,然后用户可以从此列表拖动到其他三个中的一个(这表示他们想要对所选项目执行的操作。项目也可以拖过这三个列表)

一切正常,直到您使用过滤器,然后将项目拖动到一个空的列表框(作为过滤器的结果)。

我得到的错误在下面,当从原始列表中删除该项时抛出它。

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)

有没有人遇到过类似的错误。 PagedCollectionView(传递一个可观察的集合)是错误的解决方法吗?

任何遇到这种情况的人的任何见解都会受到赞赏。

0 个答案:

没有答案