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
640
UltraGrid Cell Customization
posted

Hi Everyone

I have Ultragrid and i have column called text where there is some text and other columns like font-family,style,size,weight,color,backcolor,border and bordercolor. If i change some values in this it should get reflected in the text column according to the chosen values from all these.

I tried to do it in but i couldn get it i dont know where i have gone wrong.

Is there any way to do it.

Colud someone help me please

Thanks in advance

Ferdin

Parents
No Data
Reply
  • 37774
    posted

    Ferdin,

    You could use the InitializeRow event to check when the value in your formatting columns have been updated and then change the value of the cell in the Text column of that row accordingly.  The best way to do this would be to use a Style on the Text column of FormattedText or FormattedTextEditor.  You would likely need to build the string of formatting yourself, though.  

    The structure that I'm referring to for the InitializeRow event is:

     private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
    {
        string fontFamily = e.Row.Cells["FontFamily"].Value.ToString();
        string fontSize= e.Row.Cells["FontSize"].Value.ToString();

        // Build the formatted string here

        e.Row.Cells["Text"].Value = myFormattedText;
    }

    For an example of what string to build, you could add an UltraFormattedTextEditor to your form and click on the UITypeEditor (the button with '...') on the Value property, then use the dialog that shows up to create a formatted string.  You can see the raw value that is generated there to see how it is structured.  You can also find a list of supported xml tags here.

    -Matt

Children