We strongly recommend posting complete reproductions, since testing little snippets of code without seeing how you use them is extremely ineffective and prone to missing important details. Without a complete repro, you’re also limiting our ability to explain why things work in a particular way, when interacting with their parent containers etc.
That said, the problem in this case is that you’re not using DockPanel right (100% width on a child within one?). And it’s not even related to HitTestMode. Here’s something that should work fine: