Unplanned
Last Updated: 18 Oct 2024 15:10 by Martin Ivanov

One of the following two exceptions occur when the BindingOperations.EnableCollectionSynchronization() is used with the ItemsSource of RadTreeListView:

  • System.InvalidOperationException: 'Collection was modified; enumeration operation may not execute.'
  • System.NullReferenceException: 'Object reference not set to an instance of an object.'

When using the EnableCollectionSynchronization, the corresponding items control should allow updates of the ItemsSource collection on different threads. This is valid if the requirements to use the EnableCollectionSynchronization method are met.

The exception stack traces are:

InvalidOperationException
   at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion() in /_/src/libraries/System.Private.CoreLib/src/System/ThrowHelper.cs:line 432
   at System.Collections.Generic.List`1.Enumerator.MoveNext() in /_/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs:line 1130
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at Telerik.Windows.Data.EnumerableExtensions.<SelectRecursive>d__15`1.MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at Telerik.Windows.Data.HierarchicalCollectionViewBase.PopulateInternalList(IQueryable view)
   at Telerik.Windows.Data.QueryableCollectionView.get_InternalList()
   at Telerik.Windows.Data.HierarchicalCollectionViewBase.get_InternalCount()
   at Telerik.Windows.Data.DataItemCollection.get_Item(Int32 index)
   at Telerik.Windows.Controls.GridView.Rows.GetRowItemsAtRange(Int32 startIndex, Int32 endIndex)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.FlatLayoutStrategy.RealizeRows(Int32 startIndex, Int32 endIndex, Double& verticalOffset, HashSet`1& realizedRows)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.FlatLayoutStrategy.MeasureOverride(Size availableSize)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size availableSize)
--------------------------------------

NullReferenceException
   at Telerik.Windows.Data.QueryableCollectionView.InternalGetItemAt(Int32 index) in Telerik.Windows.Data\QueryableCollectionView.cs:line 3081
   at Telerik.Windows.Controls.GridView.Rows.GetRowItemsAtRange(Int32 startIndex, Int32 endIndex)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.FlatLayoutStrategy.RealizeRows(Int32 startIndex, Int32 endIndex, Double& verticalOffset, HashSet`1& realizedRows)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.FlatLayoutStrategy.MeasureOverride(Size availableSize)
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size availableSize)

To work this around dispatch the updates of the ItemsSource collection to the main UI thread.

 Dispatcher.BeginInvoke(new Action(() =>
 {
    // add/remove items from the source collection
 }));

Declined
Last Updated: 09 Apr 2014 08:48 by ADMIN
Created by: Trifelino
Comments: 1
Category: TreeListView
Type: Feature Request
0
Please help ... treelistview is inserting unwanted rows in between records.

Sample image attached and xaml code below ...

Please send sample application of treelistview that is working properly if possible.

Thanks.


trifee

             <telerik:RadTreeListView 
                ItemsSource="{Binding GetAccountsData.GetAccountLogParentAndChildData_Results, UpdateSourceTrigger=PropertyChanged}" 
                AutoGenerateColumns="False" 
                IsFilteringAllowed="False" 
                IsReadOnly="True"   
            >                                
                <telerik:RadTreeListView.ChildTableDefinitions>
                    <telerik:TreeListViewTableDefinition ItemsSource="{Binding Items}" />
                </telerik:RadTreeListView.ChildTableDefinitions>
1 2 3 4 5