I have the following tree in my application:
MainWindow (Window)
> LayoutRoot (Grid)
> (MyCustomControl)
> Item1 (Grid)
> Button (Button1)
MyCustomControl comes from ItemsControl and displays its items on a StackPanel.
MyCustomControl needs to know when the mouse clicked inside of itself, so I overridden the OnPreviewMouseDown method and expect to find out about any mouse click inside my control.
What happens: if I click inside Button1, the PreviewMouseDown event moves along the tree, and OnPreviewMouseDown is executed as expected. But if I click on Item1, the PreviewMouseDown event will stop right after MainWindow and won't even reach LayoutRoot.
Here are the details of the routed events I received with Snoop :
Click Button1:
(Window)
> (Border)
> (AdornerDecorator)
> (ContentPresenter)
> LayoutRoot (Grid)
> (MyCustomControl)
> (Border)
> (StackPanel)
> Item1 (Grid)
> Button1 (Button)
> Chrome (ButtonChrome)
Click on item 1:
(Window)
> (Border)
, , .
?