Gets the sort settings of the Grid. Allows or disables the sort and multiple sort, indicates how much sorted columns the Grid supports.

Namespace: Dapfor.Net.Ui
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: (


public Grid..::..GridSort Sort { get; }
Visual Basic
Public ReadOnly Property Sort As Grid..::..GridSort
Visual C++
property Grid..::..GridSort^ Sort {
	Grid..::..GridSort^ get ();
member Sort : Grid..::..GridSort with get

Property Value

Type: Grid..::..GridSort
Grid..::..GridSort settings.


Demonstrates how to work with the sort
 Copy imageCopy
public void HowToWorkWithSort(Grid grid)
    //Add an event handler that print out all sort notifications
    grid.SortChanged += delegate
        Console.WriteLine("column[Price] = {0}, column[Quantity] = {1}", grid.Headers[0]["Price"].SortDirection, grid.Headers[0]["Quantity"].SortDirection);

    //Enables the multiple sort in the grid
    grid.Sort.Enabled = true;
    grid.Sort.MultipleEnabled = true;

    //Add a header on the top level and some columns
    grid.Headers.Add(new Header());
    grid.Headers[0].Add(new Column("Price"));
    grid.Headers[0].Add(new Column("Quantity"));

    //Clear existing sort

    //Set multiple sort
    grid.Headers[0]["Price"].SortDirection = SortDirection.Descending;
    grid.Headers[0]["Quantity"].SortDirection = SortDirection.Ascending;

    //Enumerate all sorted columns in the in the top header
    foreach (Column column in grid.Headers[0].SortedColumns)
        //Do something...

    //Reverse the sort in the 'price' column
    grid.Headers[0]["Price"].SortDirection = SortDirection.Ascending;

//Console output:
//column[Price] = Descending, column[Quantity] = Undefined
//column[Price] = Descending, column[Quantity] = Ascending
//column[Price] = Ascending, column[Quantity] = Ascending

See Also