UIElement.IsHitTestVisible 屬性

定義

取得或設定宣告此元素是否可以從其呈現內容的某些部分傳回,作為點擊測試結果的值。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. 基於這個理由,除非您不想要對該控制項進行任何輸入或點擊測試,否則請務必不要將 IsHitTestVisible 設定為複合控制項上的 falseFor 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
設定為 true 的中繼資料屬性Metadata properties set to true None

適用於

另請參閱