Hello.
I'm using NetAdvantage WebClient Trial 2009.2 to evaluation.
I want to implement "Ctrl-A" like function.
So I need to select all rows in xamWebGrid.
I try this code first:
foreach (var x in webgrid.Rows){ webgrid.SelectionSettings.SelectedRows.Add(x);}
but this is too slow.
So I tryed an other code:
webgrid.SelectionSettings.SelectedRows.AddRange(webgrid.Rows);
but it does'nt match Type of Arg.
Rows is RowCollection, not match SelectedCollectionBase<Row>.
Please tell me good performance way to do it.
Hi, Stephan.
Thank you more information.
I tried your code, and it works.
Time reduced from 20 sec to 8 sec in 10,000 rows data.
It is better solution!
Thanks.
I add a little information.
In First time, this code takes 8 sec:
var src = new CustomSelection();foreach (Row r in this.XamWebGrid.Rows){ src.AddSelectItem(r);}
But in second time, it takes 0.03 sec.
I don't know Why it is.
Hi,
So, when the xamWebGrid loads, it only accesses the data necessary for what it can currently display. As your scroll, it accesses more data and creates more Rows.
What you're doing here, is accessing all of your data and creating all of the Row objects associated with the Data at once.
So depending on the type of ItemsSource you're using, it could take some time to create the rows. Although once they're created, you won't have that problem, thus the performance improvement the second time around.
Note: i would recommend that you're at least using an IList for your ItemsSource, as that would give much better performance than just an IEnumerable.
-SteveZ
I understood.
I think I wrote a code that throws away lazy evaluation.
Thanks your detailed explanation.
IList is better than IEnumerable?
Thank you for your advice!
Were there any changes in recent versions of xamGrid addressing this issue? It would be great if Ctrl + A or at least .SelectAll() would be supported out-of-the-box.