FlexGrid, by default, gives you enough options to merge in most common scenarios using AllowMerging property. However, there may be instances where you want to customize the merging options to get more out of your grid. You can customize the default merging behavior in two ways:
By default, the grid merges adjacent cells containing same non-null value. In default scenario, string comparisons are case-sensitive and blanks are included. However, you can also merge cells using a case-insensitive comparison and trimming blanks by writing a custom class that implements IComparer interface and assign it to CustomComparer property of the C1FlexGrid class.
Another way is to create a new class that derives from the C1FlexGrid class and overrides the GetMergedRange and GetData methods to provide your own custom merging logic. It merges the cells based on contextual understanding of data in FlexGrid, which is implemented through the overridden methods in the sample. The below example demonstrates custom merging in timetable of each lecturer using the WinForms FlexGrid.
For detailed implementation of more scenarios of custom merging, see the product Projects named CustomMerge, CustomMerge2, CustomMerge3, CustomMerge4.