Hi
I am working on UltraGrid, here, when I click on top or bottom boundaries of any cell, within the grid, then that particular row is getting selected. I don't want this to happen, Could u help me to overcome this!
Hi Dorine,
You mean when you click on the edge in between rows? I don't think there is any way to stop that, except to set up your grid in such a way that the cells cover the rows completely.
Try setting RowLayoutMode on the band to ColumnLayout and I think that might do it.
Hello,
I reopen this subject because I want to know if it is possible to disable this row selection when clicking on cell boundaries.
I only want the grid user to select row by the row selector.
Do you know if it's possible?
Thanks.
Dorine
The "BeforeRowActivate" part of my message is a mistake. You're correct - this event isn't cancelable. Normally, this would be handled by instead cancelling the BeforeRowDeactivate event, but you're trying to keep any rows from becoming active in the first place. Perhaps you can try handling AfterRowActivate instead, and in that event set the ActiveRow to null (to deactivate all rows). I haven't tested this, so it may be possible that you can't set the active row in this event; if that's the situation, you may need to use BeginInvoke() to delay the setting of the grid's ActiveRow until the AfterRowActivate event completes.
The SyncWithCurrencyManager property probably wasn't added until a later version of WinGrid.
I'm a bit puzzled by your statement of "I wouldn't know if I should set it to true." Are you trying to prevent row activation altogether, or just prevent the row itself from being activated and selected when you click on the row's borders?
Than you for answer, but...
Maybe I have different version (2005) but in BeforeRowActivate there is RowEventArgs parameter, so there is no Cancel.
Secondly, when I click cell i have two events: BeforeRowActivate and then BeforeCellActivate (clicking on row generates only BeforeRowActivate) so even if I had Cancel i wouldnt know if i should set it to true.
There is also no SyncWithCurrencyManager in grid...
Activation isn't the same thing as selection; activation has to do with input focus. If you want to prevent activation of rows and cells, handle the BeforeRowActivate and BeforeCellActivate events of the grid, and in both, set e.Cancel = true.
If you do this, you might also consider setting the grid's SyncWithCurrencyManager property to false. That'll prevent the situatoin where changing the Current item in your data source would cause the grid to try to activate a row.