Assembly: Dapfor.Wpf (in Dapfor.Wpf.dll) Version: 4.1.0.26317 (4.1.0.26317)
Syntax
C# |
---|
public sealed class NodeCollection : IEnumerable<Row>, IEnumerable |
Visual Basic |
---|
Public NotInheritable Class NodeCollection Implements IEnumerable(Of Row), IEnumerable |
Visual C++ |
---|
public ref class NodeCollection sealed : IEnumerable<Row^>, IEnumerable |
F# |
---|
[<SealedAttribute>] type NodeCollection = class interface IEnumerable<Row> interface IEnumerable end |
Remarks
The GridControl 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 GridControl.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 GridControl.Rows, GridControl.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.
- GridControl.Rows - Collection of all visible rows in the grid.
- GridControl.Nodes - Collection of both visible and invisible rows at the top hierarchy level.
- Row.Children - Collection of both visible and invisible children.
- Row.VisibleChildren - Collection of visible children on the same hierarchy level.
- Row.Parent - Parent row or null if the current row is on the top hierarchy level.
- Row.VisibleIndex - Row position in GridControl.Rows
- Row.ChildIndex - Row position in GridControl.Nodes or parent Row.Children
- Row.VisibleChildIndex - Row position in parent Row.VisibleChildren
- Row.NextVisible - Next visible row in parent Row.VisibleChildren container
- Row.PrevVisible - Previous visible row in parent Row.VisibleChildren container
- Row.FirstVisibleChild - First visible child
- Row.LastVisibleChild - Last visible child
- GridControl.Rows.TopVisibleRow - The first row in visible area of the grid
- GridControl.Rows.BottomVisibleRow - The last row that is at least partially visible in the visible area of the grid
- GridControl.Rows.BottomFullyVisibleRow - The last fully visible row in the visible area of the grid
Copy | |
---|---|
public void PopulateGrid(GridControl 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 rowPlaylist = grid.Rows.Add(new Playlist("Queen")); rowPlaylist.Add(new Song("Keep Yourself Alive")); rowPlaylist.Add(new Song("Great King Rat")); rowPlaylist.Add(new Song("White Queen")); grid.Rows.ExpandAll(); Console.WriteLine("{0} Rows at the top hierarchy level", grid.Nodes.Count); //Iterate all play lists (top-level items) foreach (Row playlist in grid.Nodes) { Console.WriteLine("Playlist '{0}':", playlist["Name"].Text); //Iterate all songs foreach (Row song in playlist.Children) { Console.WriteLine("Song '{0}'", song["Song"].Text); } } } //Console output: 1 Rows at the top hierarchy level Playlist 'Queen': Song 'Keep Yourself Alive' Song 'Great King Rat' Song 'White Queen' |