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!
There is about a pixel of space betwen cells where you can click on a the row, rather than the cell. What happens when you click this area depends on a number of factors. So the question is... what do you want to happen in this case?
As u said there will be having some pixel of space between each cells in UltraGrid, that is why, the entire row is getting selected. To me, this is clear now...... But, is there any way to restrict this kind of row selection? i.e., when the row is got selected, the background of the entire row is become Blue colour, now my question is.... how to change the background colour of that row from blue to transparent one?
could u help me what kind of property i have to set inorder to overcome this problem?
Hi,m
I'm still unclear about what you want to happen here.
Do you simply want to turn off row selection in the grid? That's easily done by using grid.DisplayLayout.Override.SelectTypeRow and setting it to None.
it doesnt work... could be different from vs2005 and 2008?
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.