Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make WPF Trigger for IsMouseOver on TreeViewItem NOT affect all parents of the moused-over control?

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?

like image 596
Kamiikoneko Avatar asked Jul 15 '09 12:07

Kamiikoneko


1 Answers

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.

like image 173
sean Avatar answered Oct 10 '22 04:10

sean