Collection of selected rows.

Namespace: Dapfor.Wpf.Controls
Assembly: Dapfor.Wpf (in Dapfor.Wpf.dll) Version: 4.1.0.26317 (4.1.0.26317)

Syntax

C#
public class GridSelection : IEnumerable<Row>, 
	IEnumerable
Visual Basic
Public Class GridSelection
	Implements IEnumerable(Of Row), IEnumerable
Visual C++
public ref class GridSelection : IEnumerable<Row^>, 
	IEnumerable
F#
type GridSelection =  
    class
        interface IEnumerable<Row>
        interface IEnumerable
    end

Remarks

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

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

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

    //Rows in the collection should be in order
    grid.SettingsSelection.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();
}

Inheritance Hierarchy

System..::..Object
  Dapfor.Wpf.Controls..::..GridControl..::..GridSelection

See Also