UIElement.IsHitTestVisible UIElement.IsHitTestVisible UIElement.IsHitTestVisible UIElement.IsHitTestVisible Property

定义

获取或设置一个值,该值声明是否可以返回此元素作为其呈现内容的某些部分的点击测试结果。Gets or sets a value that declares whether this element can possibly be returned as a hit test result from some portion of its rendered content. 这是依赖项属性。This is a dependency property.

public:
 property bool IsHitTestVisible { bool get(); void set(bool value); };
public bool IsHitTestVisible { get; set; }
member this.IsHitTestVisible : bool with get, set
Public Property IsHitTestVisible As Boolean

属性值

如果此元素可以从至少一个点作为命中测试结果返回,则为 true;否则为 falsetrue if this element could be returned as a hit test result from at least one point; otherwise, false. 默认值为 trueThe default value is true.

注解

此属性的有效值受到逻辑树中命中可测试元素的相对位置的影响。The effective value of this property is influenced by the relative positions of hit testable elements in the logical tree. 例如, 如果某个元素是未命中测试的元素的子元素, 则子级上属性的有效值将保留false, 即使尝试在本地设置该值也是如此。For instance, if an element is a child element of an element that is not hit test visible, the effective value of the property on the child will remain false, even if attempting to set that value locally. 出于此原因, 不要在复合控件上将设置IsHitTestVisiblefalse , 除非您不希望对该控件执行任何输入或命中测试。For this reason, it is important that you do not set IsHitTestVisible to false on a composited control unless you do not want any input or hit testing on that control. 有关命中测试的详细信息,请参阅可视化层中的命中测试For more information on hit testing, see Hit Testing in the Visual Layer.

依赖项属性信息Dependency Property Information

标识符字段Identifier field IsHitTestVisibleProperty
元数据属性设置为trueMetadata properties set to true NoneNone

适用于

另请参阅