Xceed Grid for WinForms v4.3 Documentation
Xceed.Grid.v4.3 Assembly / Xceed.Grid Namespace / GridControl Class / SelectedRows Property
Example


In This Topic
    SelectedRows Property
    In This Topic
    Gets a list of all the selected rows.
    Syntax
    'Declaration
     
    <BrowsableAttribute(False)>
    <DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property SelectedRows As SelectedRowList
    'Usage
     
    Dim instance As GridControl
    Dim value As SelectedRowList
     
    value = instance.SelectedRows
    [Browsable(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    public SelectedRowList SelectedRows {get;}

    Property Value

    A reference to a Xceed.Grid.Collections.SelectedRowList object containing all the selected rows. This collection can also be used to change the selected rows.
    Example
    The following example demonstrates how to add rows to the grid's collection of selected rows and to remove all rows which are not GroupManagerRow objects from the collection:
    Dim row As Row
    For Each row In gridControl1.SelectedRows
       If Not TypeOf row Is GroupManagerRow Then
          gridControl1.SelectedRows.Remove( row )
       End If
    Next row
    
    Dim rowToAdd As Row
    For Each rowToAdd In gridControl1.FixedHeaderRows
       rowToAdd.CanBeSelected = True
       gridControl1.SelectedRows.Add( rowToAdd )
    Next rowToAdd
    foreach( Row row in gridControl1.SelectedRows )
    {
       if ( ! ( row is GroupManagerRow ) )
       {
          gridControl1.SelectedRows.Remove( row );
       }
    }
    
    foreach( Row rowToAdd in gridControl1.FixedHeaderRows )
    {
       rowToAdd.CanBeSelected = true;
       gridControl1.SelectedRows.Add( rowToAdd );
    }
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also