Reputation: 1013
I have a tree view structured like this
Node0
-Node1
-Node11
-Node12
-Node2
And i have two panels: panel11 & panel12. I want to show panel11 if Node11 is selected & if Node12 is selected i want to show panel12. How can i do that in my WF in C#?
Upvotes: 0
Views: 904
Reputation: 5722
Write a handler for the AfterSelect
event on the treeview, where you can do whatever you have to do to handle the node that the user selected.
private void TreeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (e.node == nodePanel11)
{
Panel11.Visible = true; // This presumes that the panel already exists
// and is invisible
Panel12.Visible = false;
}
else if (e.node == nodePanel12)
{
Panel12.Visible = true;
Panel11.Visible = false;
}
}
Upvotes: 3