This is a migrated thread and some comments may be shown as answers.

Stackoverflow with UI Virtualization and SelectedItems.Clear()

2 Answers 184 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 06 May 2013, 06:41 PM
Hi I am using the DataGrid with UI virtualization enabled.
In XAML the main attributes set on the Grid are:
EnableRowVirtualization="True"
ScrollMode="Deferred"
SelectionMode="Extended"

The grid binds to a VirtualQueryableCollection that makes uses of the ItemsLoading event to load data into the VirtualQueryableCollectionView.
So a queryable is not passed in as a constructor.

The Grid is working fine except for when I want to call Grid.SelectedItems.Clear().

I am manually populating the Grid.SelectedItems with the correct rows that should be selected.

The Grid has 240,000 rows. I select a few rows at the top to the grid.
Then I scroll down the bottom of the grid.
At the bottom I add another row to the selection, so Grid.SelectedItems has 3 items in it. Everything is fine.
A call is made to Grid.SelectedItems.Clear().
The process freezes and eventually a Stackoverflow exception is thrown.
The stacktrace does not show much. Throughout the trace a call to VirtualQueryableCollection.Load() is occurring for the whole list in increments of the LoadSize (100).

This is with version:
2013.1.022.0.40

If I try version
2012.3.1129.40
The process does not have a Stackoverflow exception but is stuck in a loop and does not return.

If I select items at the top of the grid only, it works fine. And if I select items at the bottom of the grid it works fine.

The machine I work on is not connected to the internet but I may be able to provide the stacktrace if needed.

2 Answers, 1 is accepted

Sort by
0
Joshua
Top achievements
Rank 1
answered on 07 May 2013, 08:15 PM
Using remove on SelectedItems instead of clear seems to solve / prevent the issue.
0
Yordanka
Telerik team
answered on 08 May 2013, 08:29 AM
Hello Joshua,

Thank you for the feedback.

I've tried to reproduce the problem you report but to no avail. Could you check the attached test project? Is there something specific that I've missed?
 
Greetings,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Joshua
Top achievements
Rank 1
Answers by
Joshua
Top achievements
Rank 1
Yordanka
Telerik team
Share this question
or