How to denied “bubble” selecting in WPF TreeView?
-
22-10-2019 - |
Question
I have a hierarchical TreeView object with some structure:
- Main level
- second level 1
- second level 3
- second level 2
The problem is: when I select item on second level it fires "selected" event for Main level item. How can I denied it? I try use some tricks with boolean flag and original source property, but I failed it. e.Handled = true also do not give me result.
Thanks for any advices and sorry for my bad English!
Solution 2
The problem was in some strange bug in my code. When I use splashscreen in my app, event for main level fires. When I disable splashscreen - it works perfectly with e.Handled = true; trick.
So I call second splashscreen in the end of item selected evend handler for 0 ms, and it works.
Thanks all.
OTHER TIPS
Events, added using AddHandler, ignore e.Handled flag, which is likely your case. Can you check if event's Source is equal to OriginalSource and if so quit the handler?