Share via


ModuleListPage.Sort Method

Definition

Sorts the data that is displayed in the list view.

Overloads

Sort()

Sorts the data that is displayed in the list view by using the current sort column and sort order.

Sort(ColumnHeader, SortOrder)

Sorts the list view by using the specified sort column and sort order.

Sort()

Sorts the data that is displayed in the list view by using the current sort column and sort order.

protected:
 void Sort();
protected void Sort ();
member this.Sort : unit -> unit
Protected Sub Sort ()

Examples

The following example creates a custom MySort method that calls the Sort(ColumnHeader, SortOrder) or Sort() overload, depending on the Boolean value that is passed in. The two calls are essentially identical.

void MySort(bool b) {
    if (b == true)
        Sort();
    else
    // equivalent to calling Sort();
    Sort(this.SortColumn, this.SortOrder);
} 

Remarks

This method calls the Sort method, passing in the value of the SortColumn and SortOrder properties.

Applies to

Sort(ColumnHeader, SortOrder)

Sorts the list view by using the specified sort column and sort order.

public:
 void Sort(System::Windows::Forms::ColumnHeader ^ column, System::Windows::Forms::SortOrder sortOrder);
public void Sort (System.Windows.Forms.ColumnHeader column, System.Windows.Forms.SortOrder sortOrder);
member this.Sort : System.Windows.Forms.ColumnHeader * System.Windows.Forms.SortOrder -> unit

Parameters

column
ColumnHeader

The column to sort.

sortOrder
SortOrder

The sort order.

Examples

The following example changes the view mode and sorts the list view data if the value of the Microsoft.Web.Management.Client.Win32.ListPageListView.View property is changed to Microsoft.Web.Management.Client.ModuleListPageViewModes.Details.

protected override void OnSetView() {

    bool updateDescription = false;

    View currentView = ListView.View;

    if ((_lastListViewView == View.Details &&
        currentView != View.Details) ||
        currentView == View.Details) {
        updateDescription = true;
    }

    if (updateDescription){
        UpdateDescriptions(ListView.View);
        Sort(_keyHeader, this.SortOrder);
        }

    _lastListViewView = currentView;
}

Applies to