Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
835
How to allow user to deselect a grid row
posted

I'm trying to allow the user of an ultragrid to be able to deselect a grid row by just clicking on an existing selected row. I have the following relevant settings on my grid:

this.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect; AND

this.mGrid.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Single;

I've tried to hook into the CellClick event to do this, but I've found it difficult to only have that event fire when a grid row is currently selected (and preferably I would think that the developer consuming the ultragrid wouldn't have to narrow down any logic via the interaction between the AfterSelectChanged and CellClick event in order to make this work).

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi, 

    There's no property for this.

    A user can de-select a row by CTRL+Clicking on a selected row. This is standard behavior in Windows.

    As for trapping an event, I don't see any way to do this. The problem is that the row is selected before the MouseDown event fires. So checking whether the row is selected inside any event like Click, CellClick, or MouseDown will always return true and you won't be able to detect if the row was already selected or if it's being selected. At least not without jumping through some hoops like deriving your own grid control and then overriding OnMouseDown so you can check the selected state of the row before the event fires.

Children