ComponentOne FlexPivot for WinForms
C1.Win.FlexPivot.4.5.2 Assembly / C1.Win.FlexPivot Namespace / C1FlexPivotGrid Class / CustomComparer Property

In This Topic
    CustomComparer Property (C1FlexPivotGrid)
    In This Topic
    Gets or sets a custom comparer object used by the grid to perform grouping, merging, and searching operations.
    Syntax
    'Declaration
     
    Public Property CustomComparer As IComparer
    public IComparer CustomComparer {get; set;}
    Remarks

    The grid has a default System.Collections.IComparer implementation that is used to compare cells and determine if their contents are equivalent. This implementation is used when merging, grouping, or searching for values (see the C1.Win.C1FlexGrid.C1FlexGrid.AllowMerging property and the C1.Win.C1FlexGrid.C1FlexGridBase.Subtotal(C1.Win.C1FlexGrid.AggregateEnum,System.Int32,System.Int32,System.Int32,System.Int32,System.String,C1.Win.C1FlexGrid.AggregateFlags,C1.Win.C1FlexGrid.RowColFlags) and C1.Win.C1FlexGrid.C1FlexGridBase.FindRow methods).

    The default implementation is case-sensitive and takes leading and trailing blanks into account.

    If you want to merge cells using a case-insensitive comparison or trimming blanks, write a custom class that implements the System.Collections.IComparer interface and assign an instance of it to the grid's C1.Win.C1FlexGrid.C1FlexGridBase.CustomComparer property.

    Setting this property to null (Nothing in Visual Basic) restores the default behavior.

    Example
    The code below replaces the built-in comparer with a System.Collections.CaseInsensitiveComparer. This causes the C1.Win.C1FlexGrid.C1FlexGridBase.Subtotal(C1.Win.C1FlexGrid.AggregateEnum,System.Int32,System.Int32,System.Int32,System.Int32,System.String,C1.Win.C1FlexGrid.AggregateFlags,C1.Win.C1FlexGrid.RowColFlags) method to group items that differ only in case into the same groups:
    See Also