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.UiAssembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)
Syntax
C# |
---|
public Grid..::..GridSort Sort { get; } |
Visual Basic |
---|
Public ReadOnly Property Sort As Grid..::..GridSort Get |
Visual C++ |
---|
public: property Grid..::..GridSort^ Sort { Grid..::..GridSort^ get (); } |
F# |
---|
member Sort : Grid..::..GridSort with get |
Property Value
Type: Grid..::..GridSortGrid..::..GridSort settings.
Examples
Demonstrates how to work with the sort
Copy | |
---|---|
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 |