BeforeDelete event is not being raised on UltraTree control when nodes are deleted. Is this a bug, am I doing something wrong or misunderstanding what this event represents?
To reproduce, place an UltraTree control and a button onto a new Form in a new Windows Forms project. Replace the designer code with this below. Press the button to delete a node and notice that the MessageBox does not appear. Am I missing a setting or something for this event to be enabled or is this a bug?
public partial class Form1 : Form
{
public
Form1()
InitializeComponent();
this.ultraTree1.BeforeDelete += new Infragistics.Win.UltraWinTree.BeforeNodeDeleteChangedEventHandler
(ultraTree1_BeforeDelete);
UltraTreeNode node = this
.ultraTree1.Nodes.Add();
node.Text =
"Parent";
node.Nodes.Add(
"c1", "Child1");
node.Nodes.Add("c2", "Child2");
}
void ultraTree1_BeforeDelete(object sender, Infragistics.Win.UltraWinTree.BeforeNodesDeletedEventArgs
e)
MessageBox.Show(string.Format("Deleting {0}", e.Nodes.Length.ToString()));
private void button1_Click(object sender, EventArgs e)
ultraTree1.Nodes[0].Nodes.RemoveAt(0);
pnewman,
The UltraTree's BeforeDelete event only fires when an UltraTreeNode is deleted via the UI; it does not fire when an UltraTreeNode is removed programatically.
~Kim~
Kim,
Thank you for the information. It's a shame the documentation doesn't say that!
I still need some way of detecting when nodes are being deleted from the UltraTree programatically. Do you (or anyone) have any suggestions on how this might be achieved?
Thanks.