Last Updated: 22 Jul 2015 14:53 by ADMIN
Petar Mladenov
Created on: 10 Jul 2015 08:24
Category: TreeView
Type: Bug Report
Exception in VirtualizingPanel when the bound CollectionViewSource is refreshed
TreeView is bound to CollectionViewSource. Certain items are expanded. The CVS is refreshed leading to ArgumentOutOfRange Exception in the TreeViewPanel.cs

NOTE: The bug is reported via the following scenario. When the bound IsExpanded property is changed in the model, OnCollectionChanged with NotifyChangedCollectionAction.Reset is invoked.

We consider this as highly unsafe operation. What actually happens is that by the time containers are measured / arranged (because the IsExpanded is triggered) - Reset also triggers reset / measure arrange of all items. This is the same as modifying a list/collection when it is iterated - the framework wll throw an error.

To better prove this is unsafe, we also tested System.Windows.Controls.TreeView. On MouseDown, we set IsExpanded = true on collased item and in the PropertyChnaged handler we invoked OnCollectionChanged with Reset in the bound ObservableCollection. This resulted in StackOverflowException in PresentationCore.dll.

Conclusions. The Exception is fixed in the RadTreeView but we consider invoking Reset in such moment (during measure/arrange) as not supported / critical / unsafe operation.