Skip to main content

GridLevelNodeCollection.Add(String, BaseView) Method

Creates a new node and appends it to the current collection.

Namespace: DevExpress.XtraGrid

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

public GridLevelNode Add(
    string relationName,
    BaseView template
)

Parameters

Name Type Description
relationName String

A string specifying the name of the relationship that the new node will represent. This parameter’s value is used to initialize the node’s GridLevelNode.RelationName property.

template BaseView

A BaseView descendant representing the pattern View to associate with the specified relationship. This parameter’s value is used to initialize the node’s GridLevelNode.LevelTemplate property.

Returns

Type Description
GridLevelNode

A GridLevelNode object representing the created node.

Remarks

The Add method creates and initializes a new node with the specified relationship name and pattern View. The node is then appended to the collection. The order of the nodes in the collection determines the order in which the corresponding master-detail relationships will be displayed in the XtraGrid. To add a node at a specific position use the GridLevelNodeCollection.Insert method.

If the collection already contains a node whose GridLevelNode.RelationName property matches the relationName parameter’s value, then a new node will not be created. Instead the existing node’s GridLevelNode.LevelTemplate property will be set to the View provided by the template parameter.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Add(String, BaseView) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also