0
votes

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!

2
please post the relevant XAML and if possible code-behind as all. - Nawaz
I find bug. Main level event fires, when I use loading splashscreen in another gui thread (it started is another window in manual position). When I comment spashscreen calling it became normal :(. - Dmitriy

2 Answers

0
votes

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?

0
votes

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.