With UltraGrid, is there a way to use key board only to do the sorting (as if column header sort is clicked via mouse)?
Hello Vivien,
Unfortunately, UltraGrid does not have a functionality to select a column via the keyboard.
If you have some kind of MSAA (Accessibility) running that handles selecting a column header, it may be possible. If that is the case, you may have to turn off UIA support in order for your MSAA to work.
UltraControlBase.UIAutomationForCodedUITestingEnabled = false;
Hi Mihoko:
Thanks for reply. However what's in your sample code is not what I am after.
Sorry, I should have made it clearer.
What we want is for sorting to work for both mouse click and key board access, setting
ultraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect; ultraGrid1.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.Select;
is not applicable for all our instances of UltraGrid.
The question is: imaging someone has disability that cannot use mouse, is there a way to use key board navigation to select the column header? Then when A or D is pressed, we detect that it is a column header selected, we can sort via key event.
You should be able to sort UltraGrid column programmatically using UltraGridColumn's SortIndicator propertyas illustrated in the following document.
Sorting Overviewhttps://ko.infragistics.com/help/winforms/wingrid-sorting-overview
If you wish to prevent the grid from sorting when a column header is clicked, you can set UltraGrid.DisplayLayout.Override.HeaderClickAction to Select.
I have created a sample application for your reference.In this sample, a column that contains an active cell gets sorted in ascending order when 'A' key is pressed, and it gets sorted in descending order when 'D' key is pressed.
Let me know if I may be of further assistance.3108.WindowsFormsApplication1.zip
Thank you,Mihoko Kamiishi