I want to select all the rows of a xamdatagrid when a button click is done or through a shortcut key .
I am using mvvm model so it should happen from commmand not from code behind file of the view . Please suggest something .
HI ,
I am attaching a sample XamDataGrid project that implementes ICommand and selects all the Records in the XamDataGrid.
Please review my sample.
Sincerely, Matt Developer Support Engineer
HI,
Please let me know if you need further assistance regarding this case.
Sincerely,
Matt, Developer Support Engineer
HI
I have used your example and it is working fine ..except in one case .
I am grouping the rows through once column and clicking on a button select all ..and then command is called .but the same is not working because the record type is group by field ..can you please help me in solving it
Thanks
chandu
Hello Chandu,
i can suggest you modify the Execute method as follows:
public void Execute(object parameter)
{
XamDataGrid xg = parameter as XamDataGrid;
foreach (Record r in xg.Records)
GroupByRecord groupBy=r as GroupByRecord;
if (groupBy != null)
foreach (Record ch in groupBy.ChildRecords)
ch.IsSelected = true;
else r.IsSelected = true;
}
Hi, while this method works for selecting all records it seems performance is not that great.
I have a grid with 10,000 records and 2 columns. If I click on the top left cell, scroll all the way to the bottom, and shift+click the bottom right cell, all cells get instantly selected.
If I select all via button which sets IsSelected = true to all records, it takes about 10 seconds.
Is there a reason why it is so slow, and is there a faster way of selecting? Perhaps in the same way the mouse performs the selection?