Stopping TreeViewAdv nodes changing

I need to prevent a user from selecting a node based on some validation. In the WinForms version of the TreeViewAdv I can use BeforeSelect and pass args.Cancel = true. How do I achieve the same thing with the WPF tree?

1 Reply

CS C. Sudha Syncfusion Team August 24, 2009 01:29 PM UTC

Hi,

Currently, we didnt have that feature in TreeViewAdv control. However, Your requirments will be acheived by workaround.

For instance, In selected event, you write the following code snippet,

C#

private void item1_Selected(object sender, RoutedEventArgs e)
{
if (!item1selected )
{
item1selected = true;
}
else
{
(sender as TreeViewItemAdv).IsSelected = false;
}
}

Please download the attached sample for more reference.

Please let us know if you have any questions.

Thanks for choosing Syncfusion products.

Regards,
SudhaC.



TreeViewAdv_Demo_8bd30cec.zip

Loader.
Up arrow icon