UIElement.IsMouseDirectlyOver 屬性

定義

取得值,指出滑鼠指標位置是否與點擊測試結果對應,該結果會將複合項目納入考量。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.

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

屬性值

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. 如果滑鼠指標改為子專案的子專案,特別是在元素更深層範本和組合的專案上,這個屬性將會是 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. 在您未撰寫控制項的大部分情況下,請改用 IsMouseOverFor 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 NoneNone

適用於

另請參閱