Reputation: 51
I am not able to get , only the current item which is expanded . When I am trying to get the expanded item , i am getting all the expanded items from the treeview, but I don't want that , I need to get the clicked expanded item.
Upvotes: 1
Views: 2227
Reputation: 19885
Please use
e.Handled=true;
in your treeViewItem.Expanded
event handler. That way it will only fire for the actual item expanded and not bubble route to the parent tree view items.
Upvotes: 2
Reputation: 50672
You'll need to respond to the AfterExpand event.
By restricting to the click you are shutting out keyboard users.
EDIT
Sorry, that's WinForms. Here is the WPF solution:
<TreeView TreeViewItem.Expanded="TreeViewItem_Expanded" />
Upvotes: 2