Gets a collection of selected Rows.

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

Syntax

C#
public Grid..::..GridSelection Selection { get; }
Visual Basic
Public ReadOnly Property Selection As Grid..::..GridSelection
	Get
Visual C++
public:
property Grid..::..GridSelection^ Selection {
	Grid..::..GridSelection^ get ();
}
F#
member Selection : Grid..::..GridSelection with get

Property Value

Type: Grid..::..GridSelection

Remarks

You can select single or multiple rows in the grid with Row.Selected property and Grid.Selection.Enabled / Grid.Selection.MultipleEnabled property. All selected lines are added to Grid.Selection collection that supports iteration. To unselect all rows, call Grid.Selection.Clear() method.
 Copy imageCopy
public void ExampleSelection(Grid grid)
{
    //Set a new semi-transparent color for selected rows
    grid.Selection.Color = Color.FromArgb(80, 102, 36, 10);

    //Allow selection in grid
    grid.Selection.Enabled = true;

    //Allow multiple selection in grid
    grid.Selection.MultipleEnabled = true;

    //Rows in the collection should be in order
    grid.Selection.Sorted = true;


    //Select the 5th row
    grid.Rows[5].Selected = true;

    //Enumerate the selected rows...
    foreach (Row row in grid.Selection)
    {
        //Do something here...
    }

    //Clear the selection
    grid.Selection.Clear();
}

See Also