Xamarin.Android | ComponentOne
Controls / FlexGrid / Features / Merging Cells
In This Topic
    Merging Cells
    In This Topic

    C1FlexGrid control allows you to merge cells, making them span multiple rows or columns. This capability enhances the appearance and clarity of the data displayed on the grid. The effect of these settings is similar to the HTML <ROWSPAN> and <COLSPAN> tags.

    To enable cell merging, you must do two things:

    1. Set the grid's AllowMerging property to some value other than None.
    2. If you wish to merge columns, set the AllowMerging property to true in C#for each column that you would like to merge. If you wish to merge rows, set the AllowMerging property to true for each row that you would like to merge.

    The image below shows how the FlexGrid appears, after these properties have been set.

    Merging occurs if the adjacent cells contain the same non-empty string. There is no method to force a pair of cells to merge. Merging occurs automatically based on the cell contents. This makes it easy to provide merged views of sorted data, where values in adjacent rows present repeated data.

    Cell merging has several possible uses. For instance, you can use this feature to create merged table headers, merged data views, or grids where the text spills into adjacent columns.

    The following code example demonstrates how to apply cell merging in FlexGrid control. The example uses the sample created in Defining Columns topic.  

    C#
    Copy Code
    grid.AllowMerging = GridAllowMerging.Cells;