Partager via


TouchFrameEventArgs.SuspendMousePromotionUntilTouchUp Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Disables automatic mouse-event promotion for the primary touch point until all touch points report as Up.

Namespace:  System.Windows.Input
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Sub SuspendMousePromotionUntilTouchUp
public void SuspendMousePromotionUntilTouchUp()

Exceptions

Exception Condition
InvalidOperationException

No primary touch point was recorded.

-or-

The primary touch point has an action other than Down.

Remarks

Mouse-event promotions restart after a primary touch down if they are not suspended again.

You might call this method if you are sure that the client has full multi-touch capabilities. You can determine multi-touch capabilities through user-agent checks or other techniques that are available in the hosting environment.

This method enables you to cancel mouse-event promotion on a per-event basis, which is appropriate because the method exists in event data. Also, some input-capable surfaces in your Silverlight application might not be touch-enabled. Some sources, such as a button, might still need mouse promotion to work as expected. If you want to cancel mouse-event promotion for a longer period, such as a session or the application lifetime, you can routinely call SuspendMousePromotionUntilTouchUp for all registered touch-event handlers.

Touch input requires hardware that is touch-sensitive and an environment that supports the infrastructure that exposes touch events to individual applications. The need for mouse-event promotion is often related to how you handle the client cases where touch or multi-touch is not supported. For more information, see Touch Input in Silverlight.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.