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).
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.
In my grid, it seems that ctrl + click doesn't seem to be doing the job. Is there any property that would be adversely affecting this behavior? Perhaps this.mGrid.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Single? I'd like to have that property selected because I want to enforce one row max selection
Hello,
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.
Try this:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.Override.MaxSelectedRows = 1; }
Please take a look at the sample attached to this post and try with it. I have also included a video in the archive.
I tried calling the Reset methods on the ActiveCellAppearance and ActiveRowAppearance, but no luck. I did however find out that if I didn't set SelectType.Single for the SelectTypeRow that I got the behavior I wanted...but without the ability to restrict the user to selecting one row. Unless I'm missing something, it looks like there might not be a way to unselect if that property is specified.
My guess is that the row is being de-selected, but it still appears selected because it's the ActiveRow.
FAQ:How do I turn off the ActiveRowAppearance so that the active row in the grid does not appear selected.