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 .
I know this question is quite old, but I'm attempting to do something similar. I have a user base that is used to CTRL-C (to copy selected) and CTRL-A to copy-all. Is there a way to enable this function via CTRL-A key sequence?
Thank you,
Tom
Hi ,
This Solution Works only if i want all the grid records.My case is what if the grid is filtered and it is showing only 10 records out of 100 records ?
Thanks
Arjun.m
Hello,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Thanks, that worked. I was looking for this on the SelectedItems collection itself, but forgot it's a composite of cells and records.
I can suggest you use the AddRange method of the XamDataGrid's SelectedItems' Records collection. This way you will simulate the mouse click approach. You can use a coe similar to this one:
xdg.SelectedItems.Records.AddRange(xdg.Records.ToArray());
where 'xdg' is the name of the XamDataGrid.