3

According to http://msdn.microsoft.com/de-de/library/system.windows.controls.panel.background.aspx

Panel elements do not receive mouse or stylus events if a Background is not defined. If you need to handle mouse or stylus events but do not want a background for your Panel, use Transparent.

So my question is: Why? Does anybody know the reasoning for this behavior?

4

1 回答 1

3

原因是输入基于Visual Layer 中的命中测试。请特别参阅命中测试支持部分。

命中测试仅在 Visual 的呈现内容(即呈现的几何图形)上成功。当您设置它的Background属性时,Panel 最终会将填充的 RectangleGeometry 渲染为背景。

于 2012-04-17T08:41:07.560 回答