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
270
Table cell background color
posted

Table cells in the Document Engine appear to have a Background property that can be set. How? Looking at the help file that was installed with V2007.3 the property simply "exists' with absolutely no example on how to use it.

My guess is I need to create an object handle to the background property and then assign another object which is a background object that I've created before. I can't figure out or find out how this is to get done.

I've noticed this with a lot of other Infragistics objects. Why can't it be as simple as objects from other sources. Even with the VB.NET standard controls, if there is a format property of some sort, all you need to use it is:

object.formatproperty = format_value_or_object

But with Infragistics stuff, I need two objects (one a handle and the next a previously prepped object) and then marry them together under some strange ritualistic form of code.

ALL I WANT TO DO IS MAKE A WHITE BACKGROUND (preferably slightly transluscent) FOR MY TABLE CELLS!!!! I don't feel I need to do it with dozens of lines of code.

  • 12333
    posted

    Hello there :)

    Please consider the following code:

     

    =======================================

    Report theReport = new Report();

    ISection theSection = theReport.AddSection();

    //Table Pattern (think of this as a kind of "Style Sheet" for ITable

    TablePattern theTablePattern = new TablePattern();

    theTablePattern.Header.Cell.Background = new Background(Infragistics.Documents.Graphics.Brushes.Red);

    theTablePattern.Row.Cell.Background = new Background(Infragistics.Documents.Graphics.Brushes.LemonChiffon);

    ITable theTable = theSection.AddTable();

    theTable.ApplyPattern(theTablePattern);

     =====================================

     Let's examine this code. The TablePattern class represents of what you can think of (kind of) as a "Style Sheet" for the ITable implementation.

    You set various properties on the TablePattern class and then you can apply this Table Pattern to your ITable implementation.

    This will allow you to establish your cell Backgrounds to any one of the supported brushes. In this particular code, I am using solid color brushes, however, you also have various Gradient and Texture brushes.

    Check them out here: http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/DocumentEngine_Brushes.html

    -Tom