Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
ColumnStyle FormattedText on disabled cell
posted

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)

Parents
  • 69832
    Offline posted

    This behavior is by design, the logic being if we didn't gray out the text, the user might be mislead into thinking they can navigate to a URL or something (a popular use case for the FormattedText style is to show hyperlinks).

    In my opinion, the easiest way to solve this problem is to set the cell's Activation to ActivateOnly, so that it doesn't go into edit mode, and handle/cancel the BeforeCellActivate event, so that clicking on a cell in that column does not activate it.

    The attached sample demonstrates how to do this.

    DisabledFormattedText.zip
Reply Children