Hi,I want to color a part of the text in a cell. I achieve this using ColumnStyle.FormattedText and html to set the color. However, this doesn't work when the cell is disabled. The text color always stays gray.I've tried to use CellActivation.NoEdit and set the part of the text that should not be colored to SystemColors.GrayText, but then the cell activates on click. Setting the CellClickAction to something else doesn't resolve this.Can anyone point me in the right direction how to set part of a text color in a disabled cell?Thanks in advance.Vabi (TorX)
I assume you're satisfied so I closed the case. You can reopen it at any time if you need to.
That's a nice workaround. Thank you for your help Brian!
The attached sample demonstrates how to use BeforeRowDeactivate and BeforeCellDeactivate to cache the last activated cell/row so that it can be restored in the event the user tries to activate the formatted text cell.
I'm afraid there are some limitations that might make this solution unusable for you, since it is implied that the solution should mimic disabled behavior. For example, when a cell is actually disabled, navigation will pass over it and onto the next cell that can be activated, which this sample does not do. There may well be other aspects of the disabled behavior that is not possible to emulate with this approach, in which case you will have to modify it to suit your needs, or submit a product idea for the ability to override the default disabled appearance.
The row activation problem was implied because I want to mimic the disabled behaviour.
Thank you for the suggestion. I had looked at the BeforeRowActivate myself, but I noticed it's not cancellable. Even if it was, the event gets called before BeforeCellActivate, so I would be too late caching the right cell.
In the attached sample, I did not work around the row activation issue, because I wasn't aware that was a problem for you.
To prevent this, you could cancel BeforeRowActivate as well, but you would have to do something like cache the last cell that was attempted to be activated, and cancel BeforeRowActivate only when that cell is in the formatted text column.
I re-attached the sample...no idea why but when I tried to open it from the attachment, it was empty.