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
558
Color Cells
posted

Hi,

I have a XamDataGrid with a few fields in it: ID, Name, Amount.  Amount has the value plus the change.  For example, Amount = "100 (-10)".  I want to color the -10 based on some other conditions.  I tried to pass html, <p>100 <span style="color: red">-10</span></p> but that formatting does not apply.  Is there a way to tell the grid that the cells are to be html code?  Or is there an alternate route?  I used to apply styling based on a converter but the logic to determine whether the cell should be colored is fairly complex.

Thanks,

Kyle

  • 14517
    Offline posted

    Hello,

    The following article describes creating a WPF HTML Supported Textbox.

    http://www.codeproject.com/KB/WPF/htmltextblock.aspx

    You could implement something along these lines and then create a style for the CellValuePresenter and set the Template to a control template using the HTML text box, then set the CellValuePresenterStyle on the field to use that style.

     Sincerely,

    Valerie

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support