Gets a collection of selected rows.
Namespace: Dapfor.Wpf.ControlsAssembly: Dapfor.Wpf (in Dapfor.Wpf.dll) Version: 4.1.0.26317 (4.1.0.26317)
Syntax
C# |
---|
public GridControl..::..GridSelection Selection { get; } |
Visual Basic |
---|
Public ReadOnly Property Selection As GridControl..::..GridSelection Get |
Visual C++ |
---|
public: property GridControl..::..GridSelection^ Selection { GridControl..::..GridSelection^ get (); } |
F# |
---|
member Selection : GridControl..::..GridSelection with get |
Property Value
Type: GridControl..::..GridSelectionSelected rows.
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 | |
---|---|
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(); } |