Query 1[Ctrl + A]: | We have analyzed your query and the SfDataGrid will process Keyboard and Mouse interactions based on GridCell. Hence, the RoutedCommand is not worked for Window. But you can achieve your requirement by overriding ProcessKeyDown method from GridSelectionController in SfDataGrid. Please refer the below code example.
| |
Query 2[FilterRowPosition]: | In SfDatagrid, we will process the selection and navigation for other than data rows like FilerRow, AddNewRow and UnboundRow which is default behavior of SfDataGrid. If you want to process the selection excluding the FilterRow in SelectRows method, please use GridFirstDataRowIndex helper method instead proceeding the value directly. Please refer the below code example.
|
Hi Andrey, Please ignore our previous update.
Sample Location: SelectRow Regards, Srinivasan |
this.sfdatagrid.SelectionController = new Controller(sfdatagrid); public class Controller : GridSelectionController { public Controller(SfDataGrid sfdatagrid) : base(sfdatagrid) { } protected override void ProcessKeyDown(KeyEventArgs args) { if (Keyboard.IsKeyDown(Key.A) && SelectionHelper.CheckControlKeyPressed()) { this.DataGrid.SelectionController.ClearSelections(false); this.DataGrid.SelectRows(1, 10); return; } base.ProcessKeyDown(args); // Base method calling } } |
this.sfdatagrid.SelectionController = new Controller(sfdatagrid); public class Controller : GridSelectionController { public Controller(SfDataGrid sfdatagrid) : base(sfdatagrid) { } protected override void ProcessKeyDown(KeyEventArgs args) { if (Keyboard.IsKeyDown(Key.A) && SelectionHelper.CheckControlKeyPressed()) { this.DataGrid.SelectionController.ClearSelections(false); this.DataGrid.SelectRows(1, this.DataGrid.GetLastDataRowIndex()); return; } base.ProcessKeyDown(args); // Base method calling } } |