void TreeViewAfterLabelEdit(object sender, NodeLabelEditEventArgs e) { var label = e.Label; if (label != null && AfterLabelEdit != null) { // Fire the event AFTER tree node editing took place. Weired behaviour otherwise. // See http://www.codeproject.com/KB/tree/CustomizedLabelEdit.aspx and comments var doItLater = new DoItLater( delegate() { var args = new VVVV.Core.Viewer.LabelEditEventArgs(e.Node.Tag, label); AfterLabelEdit(this, args); if (args.CancelEdit) { e.Node.BeginEdit(); } else { FTreeView.SelectedNode = e.Node; } }); FTreeView.BeginInvoke(doItLater); } e.CancelEdit = true; }
void FTreeViewAfterSelect(object sender, TreeViewEventArgs e) { SelectedNode = e.Node; var doItLater = new DoItLater(() => OnSelectionChanged(CurrentSelection)); FTreeView.BeginInvoke(doItLater); }