HeaderPane
Main
Hide
Share Link
Print

Sort Method, SftBoxItems Object

Sorts items.

Syntax

C#void object.Sort(int ItemIndex, short ColNum, SftBoxSortConstants SortType);
VB.NETobject.Sort(ByVal ItemIndex As Integer, ByVal ColNum As Short, ByVal SortType As SftBoxSortConstants)
C++HRESULT object->Sort(long ItemIndex, short ColNum, enum SftBoxSortConstants SortType);
CHRESULT object->raw_Sort(long ItemIndex, short ColNum, enum SftBoxSortConstants SortType);

object

A SftBoxItems object.

ItemIndex

The zero-based index of the item whose dependents are to be sorted. Specify -1 to sort all items.

ColNum

The zero-based index of the column whose contents are to be used for sorting purposes.

SortType

Defines the sorting method used.

NameValueDescription
sortSftBoxAscending0Items defined by ItemIndex are sorted using the Cell.Text property in column ColNum, in ascending fashion. The SortCompare event is not used.
sortSftBoxDescending1Items defined by ItemIndex are sorted using the Cell.Text property in column ColNum, in descending fashion. The SortCompare event is not used.
sortSftBoxCellValueAscending2Items defined by ItemIndex are sorted using the Cell.Data property in column ColNum, in ascending fashion. The SortCompare event is not used.
sortSftBoxCellValueDescending3Items defined by ItemIndex are sorted using the Cell.Data property in column ColNum, in descending fashion. The SortCompare event is not used.
sortSftBoxItemTagStringAscending4Items defined by ItemIndex are sorted using the Item.DataTag property, in ascending fashion. The Item.DataTag property is interpreted as a string. The SortCompare event is not used. The ColNum parameter is not used, but must be a valid column.
sortSftBoxItemTagStringDescending5Items defined by ItemIndex are sorted using the Item.DataTag property, in descending fashion. The Item.DataTag property is interpreted as a string. The SortCompare event is not used. The ColNum parameter is not used, but must be a valid column.
sortSftBoxItemTagLongAscending6Items defined by ItemIndex are sorted using the Item.DataTag property, in ascending fashion. The Item.DataTag property is interpreted as a Long value. The SortCompare event is not used. The ColNum parameter is not used, but must be a valid column.
sortSftBoxItemTagLongDescending7Items defined by ItemIndex are sorted using the Item.DataTag property, in descending fashion. The Item.DataTag property is interpreted as a Long value. The SortCompare event is not used. The ColNum parameter is not used, but must be a valid column.
sortSftBoxItemTag8Items defined by ItemIndex are sorted using the SortCompare event. The SortCompare event receives the Cell(ColNum).Text, Item.DataTag and Cell(ColNum).Data properties for each item as arguments.
sortSftBoxCellTag9Items defined by ItemIndex are sorted using the SortCompare event. The SortCompare event receives the Cell(ColNum).Text, Cell(ColNum).DataTag and Cell(ColNum).Data properties for each item as arguments.
sortSftBoxCellText10Items defined by ItemIndex are sorted using the SortCompare event. The SortCompare event receives the Cell(ColNum).Text properties for each item as arguments. The parameters vData and Value of the SortCompare event are not used.

Comments

The Sort method sorts items.

Based on the specified column number ColNum, the immediate dependents of the specified item ItemIndex are sorted according to the SortType specified. To sort all items specify ItemIndex as -1.

When sorting dependents, only immediate dependents are sorted, i.e., items on the immediate lower level. Dependents of items being sorted are moved with their parent item, but are not sorted. Invoke the Sort method separately for each parent item to be sorted.

Examples

C# View entire sample code

                axSftBox1.get_Header(0).Image.Appearance = SftPictureImageConstants.sftImageSortDesc;
            m_SortDirection = Ascending;
        }

        private void SetSortDirection(bool NewDirection)
        {
            ShowSortDirection(NewDirection);
            if (NewDirection)
                axSftBox1.Items.Sort(-1, 0, SftBoxSortConstants.sortSftBoxAscending);
            else
                axSftBox1.Items.Sort(-1, 0, SftBoxSortConstants.sortSftBoxDescending);
        }

        private void Form1_Load(object sender, System.EventArgs e) {
            foreach (Control c in Controls) {
                AxSftBoxLib60.AxSftBox box = c as AxSftBoxLib60.AxSftBox;

VB.NET View entire sample code

            AxSftBox1.get_Header(0).Image.Appearance = SftPictureImageConstants.sftImageSortDesc
        End If
        m_SortDirection = Ascending
    End Sub

    Private Sub SetSortDirection(ByVal NewDirection As Boolean)
        ShowSortDirection(NewDirection)
        If NewDirection Then
            AxSftBox1.Items.Sort(-1, 0, SftBoxSortConstants.sortSftBoxAscending)
        Else
            AxSftBox1.Items.Sort(-1, 0, SftBoxSortConstants.sortSftBoxDescending)
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For Each ctl As Control In Controls

C++ View entire sample code

    ItemIndex = m_vBox->Items->Add(_T("Up/Down Buttons - Honors Windows Themes"));
    m_vBox->Item[ItemIndex]->Level = 1;
    
    AddBuiltinImage(_T("Enabled Up Button"), sftImageUp, 14, 14);
    AddBuiltinImage(_T("Disabled Up Button"), sftImageUpDisabled, 14, 14);
    AddBuiltinImage(_T("Enabled Down Button"), sftImageDown, 14, 14);
    AddBuiltinImage(_T("Disabled Down Button"), sftImageDownDisabled, 14, 14);

    ItemIndex = m_vBox->Items->Add(_T("Sort Direction Indicator"));
    m_vBox->Item[ItemIndex]->Level = 1;
    
    AddBuiltinImage(_T("Enabled Ascending Indicator"), sftImageSortAsc, 8, 8);
    AddBuiltinImage(_T("Disabled Ascending Indicator"), sftImageSortAscDisabled, 8, 8);
    AddBuiltinImage(_T("Enabled Descending Indicator"), sftImageSortDesc, 8, 8);
    AddBuiltinImage(_T("Disabled Descending Indicator"), sftImageSortDescDisabled, 8, 8);
   

See Also SftBoxItems Object | Object Hierarchy


Last Updated 11/22/2026 - (email)
© 2026 Softel vdm, Inc.