'Declaration Public Event BeforeDelete As BeforeNodeDeleteChangedEventHandler
public event BeforeNodeDeleteChangedEventHandler BeforeDelete
The event handler receives an argument of type BeforeNodesDeletedEventArgs containing data related to this event. The following BeforeNodesDeletedEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Cancel (Inherited from System.ComponentModel.CancelEventArgs) | |
DisplayPromptMsg | Determines whether or not to display the default message or dialog. |
Nodes | An array of the UltraTreeNode objects that will be deleted (read-only). |
Setting the System.ComponentModel.CancelEventArgs.Cancel property to true will prevent the UltraTreeNode from going into label edit mode.
The BeforeNodesDeletedEventArgs.Nodes property of the BeforeNodesDeletedEventArgs contains an array of the UltraTreeNode objects that are about to be deleted.
By default, the UltraTree will automatically display a confirmation dialog before Deleting nodes. To prevent this dialog from appearing, set the BeforeNodesDeletedEventArgs.DisplayPromptMsg property of the BeforeNodesDeletedEventArgs to false.
Imports Infragistics.Win.UltraWinTree Private Sub ultraTree1_BeforeDelete(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTree.BeforeNodesDeletedEventArgs) Handles ultraTree1.BeforeDelete Dim sb As New System.Text.StringBuilder() sb.Append("The following nodes are about to be deleted: ") Dim node As UltraTreeNode ' Loop over the nodes that are about to be deleted. ' Note: The Nodes collection exposed by the event args ' is read-only. For Each node In e.Nodes sb.Append(node.Key) sb.Append(", ") Next sb.Append(" Press ''OK'' or ''Cancel''.") Dim dr As DialogResult dr = MessageBox.Show(Me, _ sb.ToString(), _ "Deleting Nodes", _ MessageBoxButtons.OKCancel) If dr = DialogResult.Cancel Then e.Cancel = True ' Set the DisplayPromptMsg flag to false so the ' default messagebox will be suppressed. e.DisplayPromptMsg = False End Sub
using System.Diagnostics; using Infragistics.Win.UltraWinTree; private void ultraTree1_BeforeDelete(object sender, Infragistics.Win.UltraWinTree.BeforeNodesDeletedEventArgs e) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("The following nodes are about to be deleted: "); // Loop over the nodes that are about to be deleted. // Note: The Nodes collection exposed by the event args // is read-only. foreach ( UltraTreeNode node in e.Nodes ) { sb.Append( node.Key ); sb.Append( ", " ); } sb.Append(" Press ''OK'' or ''Cancel''."); DialogResult dr = MessageBox.Show( this, sb.ToString(), "Deleting Nodes", MessageBoxButtons.OKCancel ); if ( dr == DialogResult.Cancel ) e.Cancel = true; // Set the DisplayPromptMsg flag to false so the // default messagebox will be suppressed. e.DisplayPromptMsg = false; }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2