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,
Could you provide more details about what exactly is the behavior that you consider slow?
Thanks,
Thanks for reply.1. I create a instance of XamWebGrid and set a event handler to KeyDown event.2. set Data (it has 10,000 rows) to XamWebGrid.ItemsSource.3. select all rows by XamWebGrid.SelectionSettings.SelectedRows.AddProcess takes about 20 sec at step 3.But, User can select all rows by mouse, "Click first row and Shift-Click last row".It takes about 0 sec.So, I say "too slow".I think SelectedRows.Add is too slow.Code is this:using System.Collections.Generic;using System.Windows;using System.Windows.Controls;using Infragistics.Silverlight.Controls;using Infragistics.Silverlight;namespace sample{ public partial class MainPage : UserControl { private XamWebGrid webGrid; public MainPage() { InitializeComponent(); } private void ButtonSearch_Click(object sender, RoutedEventArgs e) { webGrid = new XamWebGrid(); webGrid.EditingSettings.AllowEditing = EditingType.None; webGrid.SelectionSettings.CellClickAction = CellSelectionAction.SelectRow; webGrid.SelectionSettings.RowSelection = SelectionType.Multiple; webGrid.KeyDown += new System.Windows.Input.KeyEventHandler(onKeyDown); Grid.SetColumn(webGrid, 1); LayoutRoot.Children.Add(webGrid); List<sampleWebService.ITEM> testdata = new List<sampleWebService.ITEM>(); for (int i = 0; i < 10000; ++i) { sampleWebService.ITEM item = new sampleWebService.ITEM(); item.ATTR1 = i.ToString(); testdata.Add(item); } webGrid.ItemsSource = testdata; } private void onKeyDown(object sender, System.Windows.Input.KeyEventArgs e) { // Ctrl-A if (e.Key == System.Windows.Input.Key.A && System.Windows.Input.Keyboard.Modifiers == System.Windows.Input.ModifierKeys.Control) { foreach (var x in webGrid.Rows) { webGrid.SelectionSettings.SelectedRows.Add(x); } } } }}