Adds a data object of user-defined class as a child to this Row at specified position.

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

Syntax

C#
public Row Add(
	Object dataObject,
	int childIndex
)
Visual Basic
Public Function Add ( 
	dataObject As Object,
	childIndex As Integer
) As Row
Visual C++
public:
Row^ Add(
	Object^ dataObject, 
	int childIndex
)
F#
member Add : 
        dataObject : Object * 
        childIndex : int -> Row 

Parameters

dataObject
Type: System..::..Object
Data object.
childIndex
Type: System..::..Int32
Index in Children collection.

Return Value

Type: Row
A new Row, having this row as the parent.

Remarks

Data can be added into the grid via Grid.Rows.Add(object dataObject) method call. This method returns object of Row type. To build a hierarchy, it is enough to call the Row.Add(object) method, which in turn returns a new Row object. This way a programmer can build almost any data hierarchy in the .Net Grid. All headers and rows have their own zero-based hierarchical level that is defined by Header.Level and Row.Level properties. To display data in every row, .Net Grid takes header of the same level as that row. However, if that level doesn't have a header, the header for the previous hierarchical level is used. In other words, if only one header is present, the grid will behave like Microsoft Windows Explorer.

 Copy imageCopy
void PopulateGrid(Grid grid)
{
    //Add a new object to the scrollable rows on the top hierarchical level
    Row row = grid.Rows.Add(new SomeObject());
    //Add some children to the already inserted row
    row.Add(new SomeChild());
    row.Add(new SomeChild());
}

Thread Safety

The function is thread safe. New Row is added with blocking the calling thread.

See Also