TreeView - Forbid empty node rename

113 Views Asked by At

I have a TreeView (using Crownwood.DotNetMagic, it should be similar to WinForms) and when the user edits a node, he should not be allowed to leave the edit mode when the text is empty.

I've tried doing this in my AfterLabelEdit but it doesn't exactly do what I want: It sets the text back to the original text but I want it to stay empty in the edit mode (the user should just not be allowed to commit his changes)

if (String.IsNullOrEmpty(e.Label))
{
    e.Cancel = true;
    e.Node.BeginEdit();
    return;
}

The TreeView has similar events like this treeview from WinForms plus some more.

0

There are 0 best solutions below