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.

 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 None