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
105
How to underline the text in a cell and then click it to trigger a event
posted

Dear Reader,

Suppose I have a grid , I hava  alreay set my ColumnStyle to "FormattedText". The originaltext in the cell is "Hello World" . And I use "string .Replace("Hello", "<font color=\"red\">Hello</font>")" to change color of the originaltext.

Then, I want to underline the whole text "Hello World" in this cell(but I don't kown how).  And when I click this text ,  I can trigger an event just like the event "ClickCellButton" (but I don't want to set ColumnStyle to Button). So I can get the object of the Cell or Row , afterward, I can do some other function.  How can I do this? 

  • 3707
    Verified Answer
    posted

    The code snippet below of the BeforeCellActivate event might give you some ideas. The snippet shows you how to underline the text inside, but in this event you could also use other members of e.Cell..to get the values for the cell, row, etc.

    private void ultraGrid1_BeforeCellActivate(object sender, CancelableCellEventArgs e)
    {
        e.Cell.Appearance.FontData.Underline = DefaultableBoolean.True;
    }