0

I have a WrapPanel that has a button as a child element. Both the WrapPanel and the Button have the PreviewMouseLeftButtonDown event defined.

I have noticed that when I click the Button, the WrapPanel's event is fired before the Button's event. Is there anyway to change that?

H.B.
  • 166,899
  • 29
  • 327
  • 400
B-Rad
  • 1,519
  • 5
  • 17
  • 32

2 Answers2

2

Because Preview* events are tunneling, they travel from the root to the source, so they are raised on the panel, which is closer to the root, first. Use the bubbling version (MouseLeftButtonDown) to have the event travel up the tree.

H.B.
  • 166,899
  • 29
  • 327
  • 400
0

When you set the property IsHItTestVisible to false then mouse triggered events like a clicks will be ignored.

marc wellman
  • 5,808
  • 5
  • 32
  • 59