Hello!
I would like to disable some rows (depending on its values) and make them not selectable or clickable.
I have tried to set e.row.activation = activation.disabled in the InitializeRow event of the grid.
It works more or less, the row looks disabled but it can still be selected and if it is clicked, the click events fire.
Is there a way to accomplish this?
I have used the same approach when using a UltraCombo, and that works exactly as I want. Each row looks disabled, and it cannot be selected.
/Henrik
Hi Henrik,
You are saying you can click on a disabled row and select it? That sounds like a bug to me. A disabled row should not be selectable.
I tried this out and I can't get the behavior you describe. Clicking on a disabled row does not select that row, and I am also unable to select or activate that row via the keyboard.
As far as the mouse events go, I think they will still fire and that's correct - they should fire.
Henrik,
Can you post here a sample application that demonstrates the issue you have described?
Here comes the sample. I am really excited to see what I have missed this time ;-)
I tried this out again using both your sample and mine.
The row you click is not being selected, it's becoming Active.
Not everyone is clear on the difference, so just in case you're not, there can only be one active row, and it's the typically the same as the Current row in the BindingManager. There can be many selected rows, although in your case, you are only allowing a single selected row.
So the row in your sample is getting activated, but not selected. There's really no way to prevent a row from becoming Active, because the grid synchronizes the active row with the current row in the BindingManager. Even if you could disable the activation of a row in the grid, it's always possible for the BindingManager's current row to be set and the grid has to follow it. So preventing the user from activating a row isn't really possible.
The real problem here isn't that the row is activating, but that it appears activated (and therefore looks like it is selected when it's really no), and this is caused you the Style Library you are using. The easiest way around this is to turn off the active appearance on the grid.
e.Layout.Override.ActiveAppearancesEnabled = DefaultableBoolean.False