ContentElement.IsMouseDirectlyOver ContentElement.IsMouseDirectlyOver ContentElement.IsMouseDirectlyOver ContentElement.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.

 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指標位於 literal 元素上方時, 才會使用這個屬性, 就像是針對點擊測試一樣。Unlike IsMouseOver, this property is only true if the mouse pointer is over the literal element - as it is for a hit test. 如果滑鼠指標改為在子專案上方, 特別是針對屬於專案深度樣板和合成一部分的專案, 這個屬性將會是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在 capture 時, 這個屬性會繼續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