[]
        
(Showing Draft Content)

C1.Win.C1FlexGrid.CellStyle.MergeWith

MergeWith Method

MergeWith(CellStyle)

Copies all elements defined in a source style to this style.

Declaration
public void MergeWith(CellStyle sourceStyle)
Parameters
Type Name Description
CellStyle sourceStyle
Remarks

This method is used to create styles preserving existing style elements such as DataType or Format.

Examples

The code below changes a column so it looks like a fixed column, without modifying the column's data type, alignment, etc.

// create a new style
CellStyle cs = _flex.Styles.Add("newStyle");

// set data type, alignment
cs.DataType = typeof(int);
cs.TextAlign = TextAlignEnum.CenterCenter;

// copy remaining elements from "Fixed" style
cs.MergeWith(_flex.Styles.Fixed);

// assign new style to grid column
_flex.Cols[col].Style = cs;