ContentElement.IsMouseDirectlyOver 屬性

定義

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

public:
 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,只有當滑鼠指標位於 literal 元素上方時,才會 true 這個屬性,就像是針對點擊測試一樣。Unlike IsMouseOver, this property is only true if the mouse pointer is over the literal element - as it is for a hit test. 如果滑鼠指標改為使用子專案,特別是針對屬於專案更深入的範本和撰寫之專案的元素,則會 false這個屬性。If 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. 在大部分不是撰寫控制項的案例中,請改用 IsMouseOverFor most scenarios where you are not authoring controls, use IsMouseOver instead.

如果這個專案已捕捉滑鼠,而且這個屬性在 capture 時 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
設定為 true 的中繼資料屬性Metadata properties set to true NoneNone

適用於

另請參閱