Back to Devexpress

RepositoryItemBreadCrumbEdit.NewNodeAdding Event

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitembreadcrumbedit-ab033e09.md

latest4.1 KB
Original Source

RepositoryItemBreadCrumbEdit.NewNodeAdding Event

Occurs each time a new node is about to be added to the BreadCrumbEdit.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Events")]
public event BreadCrumbNewNodeAddingEventHandler NewNodeAdding
vb
<DXCategory("Events")>
Public Event NewNodeAdding As BreadCrumbNewNodeAddingEventHandler

Event Data

The NewNodeAdding event's data class is DevExpress.XtraEditors.BreadCrumbNewNodeAddingEventArgs.

Remarks

When a BreadCrumbEdit has to navigate to an unknown BreadCrumbEdit.Path, it raises the ValidatePath event. Handle this event to disable the navigation or enable it and create required nodes.

If you choose to create the nodes, the BreadCrumbEdit raises the NewNodeAdding event. This event allows you to customize a new node specified by the e.Node parameter. Use the e.Value parameter to obtain a node value.

csharp
private void breadCrumbEdit1_Properties_ValidatePath(object sender, DevExpress.XtraEditors.BreadCrumbValidatePathEventArgs e) {
    if (e.Path == "Node 1\\Node 2\\Node 3") e.ValidationResult = DevExpress.XtraEditors.BreadCrumbValidatePathResult.CreateNodes;
    else e.ValidationResult = DevExpress.XtraEditors.BreadCrumbValidatePathResult.Cancel;
}
private void breadCrumbEdit1_Properties_NewNodeAdding(object sender, DevExpress.XtraEditors.BreadCrumbNewNodeAddingEventArgs e) {
    e.Node.Caption = "My Node 1";
    . . .
    e.Node.PopulateOnDemand = true;
}
vb
Private Sub breadCrumbEdit1_Properties_ValidatePath(sender As Object, e As DevExpress.XtraEditors.BreadCrumbValidatePathEventArgs)
    If e.Path = "Node 1\Node 2\Node 3" Then
        e.ValidationResult = DevExpress.XtraEditors.BreadCrumbValidatePathResult.CreateNodes
    Else
        e.ValidationResult = DevExpress.XtraEditors.BreadCrumbValidatePathResult.Cancel
    End If
End Sub
Private Sub breadCrumbEdit1_Properties_NewNodeAdding(sender As Object, e As DevExpress.XtraEditors.BreadCrumbNewNodeAddingEventArgs)
    e.Node.Caption = "My Node 1"
    . . .
    e.Node.PopulateOnDemand = True
End Sub

Finally, the RepositoryItemBreadCrumbEdit.QueryChildNodes event fires. This event allows you to dynamically populate the newly created node’s BreadCrumbNode.ChildNodes collection.

Read the following topic for detailed information: Breadcrumb Edit Control.

See Also

ValidatePath

QueryChildNodes

Breadcrumb Edit Control

RepositoryItemBreadCrumbEdit Class

RepositoryItemBreadCrumbEdit Members

DevExpress.XtraEditors.Repository Namespace