如何从面板位置检测元素。 [英] How to detect element from the position of panel.
本文介绍了如何从面板位置检测元素。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在下面的可视树中有一个面板。
I have a panel as in the below visual tree.
<Grid>
<Canvas/>
<StackPanel Background="Transparent"/>
</Grid>
我已将背景设置为对堆栈面板透明。这样我就无法检测到画布中的任何元素。有没有办法检测画布中的元素?
$
I have set background transparent to the stack panel. So that I am unable to detect any element in the canvas. Is there any way to detect the elements in the Canvas?
推荐答案
你可以尝试不使用透明背景,而是使用空背景。 或者您可以设置 IsHitTestVisible =" False"
You can try to not have a transparent background, instead use a null background. Or you can set IsHitTestVisible="False"
这篇关于如何从面板位置检测元素。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文