Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread Namespace / ColumnHeader Class / AutoSortIndex Property
Example


In This Topic
    AutoSortIndex Property (ColumnHeader)
    In This Topic
    Gets or sets which column header row displays the sort indicator when there are multiple column header rows.
    Syntax
    'Declaration
     
    Public Property AutoSortIndex As Integer
    'Usage
     
    Dim instance As ColumnHeader
    Dim value As Integer
     
    instance.AutoSortIndex = value
     
    value = instance.AutoSortIndex
    public int AutoSortIndex {get; set;}

    Property Value

    Integer row index of the row in which to display the sort indicator
    Remarks

    If your header has multiple column header rows, you can specify which row displays the sort indicator by setting this property. To specify the index, set the property to a value between 0 and n-1, where 0 is the top row and n is the number of header rows. Any value above n-1 simply puts the sort indicator in the bottom row.

    If you set this property to specify a row to display the sorting indicator, for example, header row 3, and then later change the number of column header rows to be less than 3, the sort indicator is displayed in the bottom row, as if the RowCount property is set to -1. However, if you then change the number of header rows to 3 or greater, the sort indicator is again displayed in header row 3. Use the RowCount property to specify how many column header rows the component displays.

    You can allow users to sort data by clicking a column header using the Column.AllowAutoSort property (or SheetView.AutoSortColumn property) to specify the type of sorting and whether to display the sort indicator.

    This property does not have an effect unless the Visible property (or the SheetView.ColumnHeaderVisible property) is set to true, the column header that displays the sort indicator is not hidden, and the Column.AllowAutoSort property (or SheetView.AutoSortColumn property) is set to true.

    Example
    This example specifies which column header row displays the sort indicator when there are multiple column headers.
    FarPoint.Win.Spread.ColumnHeader ch;
    ch = fpSpread1.ActiveSheet.ColumnHeader;
    ch.RowCount = 3;
    ch.AutoSortIndex = 2;
    fpSpread1.ActiveSheet.Columns[-1].AllowAutoSort = true;
    Dim ch As FarPoint.Win.Spread.ColumnHeader
    ch = fpSpread1.ActiveSheet.ColumnHeader
    ch.RowCount = 3
    ch.AutoSortIndex = 2
    fpSpread1.ActiveSheet.Columns(-1).AllowAutoSort = True
    See Also