Sorting settings of the Grid. Enables or disables sorting and multiple sorting.

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

Syntax

C#
[TypeConverterAttribute("Dapfor.Net.Design.ExpandableConverter,Dapfor.Net.Design,Version=2.10.3.24917,Culture=neutral,PublicKeyToken=4427dced42249680")]
public class GridSort
Visual Basic
<TypeConverterAttribute("Dapfor.Net.Design.ExpandableConverter,Dapfor.Net.Design,Version=2.10.3.24917,Culture=neutral,PublicKeyToken=4427dced42249680")>
Public Class GridSort
Visual C++
[TypeConverterAttribute(L"Dapfor.Net.Design.ExpandableConverter,Dapfor.Net.Design,Version=2.10.3.24917,Culture=neutral,PublicKeyToken=4427dced42249680")]
public ref class GridSort
F#
[<TypeConverterAttribute("Dapfor.Net.Design.ExpandableConverter,Dapfor.Net.Design,Version=2.10.3.24917,Culture=neutral,PublicKeyToken=4427dced42249680")>]
type GridSort =  class end

Examples

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
    grid.Sort.Clear();

    //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

Inheritance Hierarchy

System..::..Object
  Dapfor.Net.Ui..::..Grid..::..GridSort

Thread Safety

The class is not thread safe.

See Also