Back to Devexpress

GridLevelNodeCollection.Add(String, BaseView) Method

windowsforms-devexpress-dot-xtragrid-dot-gridlevelnodecollection-dot-add-x28-system-dot-string-devexpress-dot-xtragrid-dot-views-dot-base-dot-baseview-x29.md

latest4.2 KB
Original Source

GridLevelNodeCollection.Add(String, BaseView) Method

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

Namespace : DevExpress.XtraGrid

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
public GridLevelNode Add(
    string relationName,
    BaseView template
)
vb
Public Function Add(
    relationName As String,
    template As BaseView
) As GridLevelNode

Parameters

NameTypeDescription
relationNameString

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

TypeDescription
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.

winforms-grid-visualize-master-detail-data/VB/Form1.vb#L38

vb
Dim cardView1 As CardView = New CardView(gridControl1)
gridControl1.LevelTree.Nodes.Add("CategoriesProducts", cardView1)
'Specify text to be displayed within detail tabs.

See Also

Insert(Int32, String, BaseView)

GridLevelNodeCollection Class

GridLevelNodeCollection Members

DevExpress.XtraGrid Namespace