开发者

Making a control visible to hit-testing but transparent to drag&drop

I have an ItemsControl that displays items as polylines and has a transparent background. I want to make this control invisible as a drop-target (so that the control underneath it can receive drag-drop events), but I do want to make it visible for hit-testing so that I can click on the polylines and perform operations on them.

I found the IsHitTestVisible property. However it enables or disables both drag-drop and hit-testing. Is there any way to make the control be "invisible" just as a possible drop target, but leaving it visible for hit-testing and mouse events?

Thanks.

Update

I eventually found out that an ItemsControl, even if its background is transparent, somehow hides the elements underneath it from mouse events. So the problem is not with drag-drop. Do you know how can I make it be really transparent and allow the items underneath it have开发者_运维技巧 mouse events?


You would need to set it's Background to null, or {x:Null} in XAML. This works like transparent, but doesn't allow that area to be hit-test as part of the control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜