11010 : Is there a way to show more than one header-line (more than one column) and / or mantain the Cell layout in the header?

Question


We have an application that shows more than a single collumn in the Grid, and each Cell in a different colour, but when switching to Schedule Mode, the colours and other columns are not shown in the header. Is there a way to show more than one header-line (more than one column) and / or mantain the Cell layout in the header? Thank you.

 

Answer


You can change the header cell layout by setting the GridColumn.ColumnCell.CellLayout to the CellLayout of your choice. The header cells use the HeaderBackgroundColor, HeaderBackgroundGradiantColor  properties for colors, besides that they work the same way.< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

10033 : Id like to put my own labels inside the headers of each column.

Question

Id like to put my own labels inside the headers of each column.
Is this possible?  How?

Thanks.

 

Answer

When you define you columns you set the Title property;

            GridColumn c_st=gantt1.Grid.Columns.AddNew(CellType.SingleText);
            GridColumn c_mt=gantt1.Grid.Columns.AddNew(CellType.MultiText);
            GridColumn c_td=gantt1.Grid.Columns.AddNew(CellType.TimeDate);

            c_st.Title=“SingleText”;
            c_mt.Title=“MultiText”;
            c_td.Title=“TimeDate”;

You can then control how the column headers are rendered by assigning CellLayouts. The simple way to assign a named CellLayout to the complete column is to set the gantt1.Grid.Columns.LayoutName to the name of an existing CellLayout in the Gantt.Grid.CellLayouts collection.

A more advanced way, that allows you to have unique CellLayouts all cells, including header cells, is to in runtime assign a CellLayout object the the Cell.Layout property. For header cells you reach the cell object via the Column object; GridColumn.ColumnCell.

You can also inject html code in the headers or in any cell by assigning them values with html snippets in them; like instead of col.Title=”the title” you can set col.Title=”<b>the title</b>”…