FlexSheet for WPF | ComponentOne
Customizing Appearance / Customizing Cells / Cell Formatting / Fill Color
In This Topic
    Fill Color
    In This Topic

    C1FlexSheet allows you to fill colors in cells to highlight particular data. The data can be highlighted by filling back color in cells. For example, to fill orange color in a cell, you can use the following code:

    flex.SetCellFormat(flex.Selection.Cells, CellFormat.Background, New SolidColorBrush(Colors.Orange))
    
    flex.SetCellFormat(flex.Selection.Cells, CellFormat.Background,
                       new SolidColorBrush(Colors.Orange));
    

    After filling color, the selected cell looks similar to the following:

    Cell with color

    Similarly, you can add and apply any color of your choice, available in the predefined set of system colors, to the selected cells at runtime.

    You can also remove the fill color applied to a cell by adding the following code:

    flex.SetCellFormat(flex.Selection.Cells, CellFormat.Background, Nothing)
    
    flex.SetCellFormat(flex.Selection.Cells, CellFormat.Background, null);