Collection of all visible Rows.

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

Syntax

C#
[TypeConverterAttribute("Dapfor.Net.Design.ExpandableConverter,Dapfor.Net.Design,Version=2.10.3.24917,Culture=neutral,PublicKeyToken=4427dced42249680")]
public sealed class RowCollection : IEnumerable<Row>, 
	IEnumerable
Visual Basic
<TypeConverterAttribute("Dapfor.Net.Design.ExpandableConverter,Dapfor.Net.Design,Version=2.10.3.24917,Culture=neutral,PublicKeyToken=4427dced42249680")>
Public NotInheritable Class RowCollection
	Implements IEnumerable(Of Row), IEnumerable
Visual C++
[TypeConverterAttribute(L"Dapfor.Net.Design.ExpandableConverter,Dapfor.Net.Design,Version=2.10.3.24917,Culture=neutral,PublicKeyToken=4427dced42249680")]
public ref class RowCollection sealed : IEnumerable<Row^>, 
	IEnumerable
F#
[<SealedAttribute>]
[<TypeConverterAttribute("Dapfor.Net.Design.ExpandableConverter,Dapfor.Net.Design,Version=2.10.3.24917,Culture=neutral,PublicKeyToken=4427dced42249680")>]
type RowCollection =  
    class
        interface IEnumerable<Row>
        interface IEnumerable
    end

Field Value

Type:
Collection of visible rows.

Remarks

The grid has two row indexing system. Rows performs linear indexing of visible rows in a grid without regard to hierarchy. It means that this collection contains all visible (not filtered and non-collapsed by parent) rows. VisibleIndex property specifies position of a visible row in Rows. The second time of indexing is related to hierarchical structure of the grid. Rows at the first hierarchy level can be accessed with Grid.Nodes property. This collection contains both visible and invisible rows that are located on the same hierarchy level. Every row may contain child rows that can be accessed via Children property. Neither filtering, nor visibility affect row presence in this collection. ChildIndex property defines hierarchical position of a row If the row is on the top level, it is in Nodes, otherwise it is in parent Children container. The row also has VisibleChildren container that contains only visible children on the same hierarchy level. You can use VisibleChildIndex property to determine Row position in VisibleChildren of the parent.

One row can be present in different containers, including Grid.Rows, Grid.Nodes, Row.Children, etc. Containers organize grid structure and enable precise definition of data location. For hierarchies the grid provides a convenient API that can be used to determine parent, children and adjacent visible rows. The list of most frequent methods and properties used for data indexing is provided below.

If you work with reference-type data objects, you can use convenient grid features to search row or rows that contain the required data object.

You can get a data object that is associated with a row by calling Row.DataObject property. The same data object may be contained in multiple grid rows. You can get them using Grid.DataObjects.Find(object) method. If you need only the first row, you can use Grid.DataObjects.FindFirstRow(object) method.

 Copy imageCopy
public void PopulateGrid(Grid grid)
{
    //Configure the headers
    grid.Headers.Add(new Header());
    grid.Headers[0].Add(new Column("Name"));

    grid.Headers.Add(new Header());
    grid.Headers[1].Add(new Column("Song"));

    Row rowPlaylist1 = grid.Rows.Add(new Playlist("Queen"));
    rowPlaylist1.Add(new Song("Keep Yourself Alive"));
    rowPlaylist1.Add(new Song("Great King Rat"));
    rowPlaylist1.Add(new Song("White Queen"));

    rowPlaylist1.ExpandAll();

    Row rowPlaylist2 = grid.Rows.Add(new Playlist("Beetles"));
    rowPlaylist2.Add(new Song("Love Me Do"));
    rowPlaylist2.Add(new Song("From Me to You"));
    rowPlaylist2.Add(new Song("Please Please Me"));
    rowPlaylist2.Expanded = false;

    Row rowPlaylist3 = grid.Rows.Add(new Playlist("Scorpions"));
    rowPlaylist3.Add(new Song("Fly to the Rainbow"));
    rowPlaylist3.Add(new Song("Rock You Like a Hurricane"));
    rowPlaylist3.Expanded = true;


    Console.WriteLine("{0} visible rows in the grid", grid.Rows.Count);
    //Iterate all playlists (top-level items)
    foreach (Row row in grid.Rows)
    {
        Console.WriteLine("Row {0}: {1}", row.VisibleIndex, row[0].Text);
    }
}

//Console output:
8 visible rows in the grid
Row 0: Queen
Row 1: Keep Yourself Alive
Row 2: Great King Rat
Row 3: White Queen
Row 4: Beetles
Row 5: Scorpions
Row 6: Fly to the Rainbow
Row 7: Rock You Like a Hurricane

Inheritance Hierarchy

System..::..Object
  Dapfor.Net.Ui..::..RowCollection

See Also