UIElement.IsMouseDirectlyOver UIElement.IsMouseDirectlyOver UIElement.IsMouseDirectlyOver UIElement.IsMouseDirectlyOver Property


取得值,指出滑鼠指標位置是否與點擊測試結果對應,該結果會將複合項目納入考量。Gets a value that indicates whether the position of the mouse pointer corresponds to hit test results, which take element compositing into account. 這是相依性屬性。This is a dependency property.

 property bool IsMouseDirectlyOver { bool get(); };
public bool IsMouseDirectlyOver { get; }
member this.IsMouseDirectlyOver : bool
Public ReadOnly Property IsMouseDirectlyOver As Boolean


如果滑鼠指標位於與點擊測試相同的項目結果上方,則為 true;否則為 falsetrue if the mouse pointer is over the same element result as a hit test; otherwise, false. 預設為 falseThe default is false.



不同於IsMouseOver,這個屬性才true如果滑鼠指標位在常值的項目-以用於點擊測試。Unlike IsMouseOver, this property is only true if the mouse pointer is over the literal element - as it is for a hit test. 如果滑鼠指標位於子系項目上方,特別是項目的一部分的項目更深入的範本和複合 (compositing),這個屬性會是falseIf the mouse pointer is instead over a child element, in particular over elements that are part of an element's deeper template and compositing, this property will be false. 除非您知道控制項的複合 (比方說,您使用這個屬性的自訂控制項範本中的控制項,您所定義),這個屬性可能會傳回非預期的結果。Unless you know how a control is composited (for example, you use this property in a custom control template for a control that you define), this property might return unexpected results. 大部分的情況下,您不撰寫控制項,使用IsMouseOver改。For most scenarios where you are not authoring controls, use IsMouseOver instead.

如果將滑鼠擷取由這個項目,而且這個屬性為true次擷取的詳細資訊,此屬性會繼續傳回true直到遺失滑鼠捕捉並的指標不是透過其範圍。If the mouse is captured by this element, and this property is true at time of capture, this property will continue to return true until mouse capture is lost and the pointer is not over its bounds.

相依性屬性資訊Dependency Property Information

識別項欄位Identifier field IsMouseDirectlyOverProperty
若要設定的中繼資料屬性 trueMetadata properties set to true None