I understand why this is happening. The bounding box of a parent TreeViewItem includes its children's bounding boxes, so when I am moused over a TreeViewItem, all its parents in the tree are also moused over. Is there something besides IsMouseOver I should be using?
This link provided a great solution that worked for me.
Effectively, you can override the ControlTemplate and specify the SourceName
for the IsMouseOver
Setter to just the header portion of the TreeViewItem
. So yes, you are technically moused over both the child and parent TreeViewItems
, but the trigger only fires for the item where the cursor is over the header.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With