Bagikan melalui


MouseWheelEventArgs.Handled Property

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

Gets or sets a value that marks the routed event as handled, and prevents most handlers along the event route from rehandling the same event.

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

Syntax

'Declaration
Public Property Handled As Boolean
public bool Handled { get; set; }

Property Value

Type: System.Boolean
true if the routed event is marked as handled. false if the routed event is kept unhandled, which permits the event to potentially route further and be acted on by other handlers. The default is false.

Remarks

The HTML DOM OnMouseWheel event is not raised if the event is marked as handled at any point in its routing path. The Silverlight plug-in marks the associated browser event as handled and therefore, prevents it from being reported to the HTML DOM.

A property named Handled exists on certain routed-event data classes in Silverlight, and setting its value to true influences behavior of the Silverlight event system. If you set Handled to true, the event is usually not routed to the next object along the event route.

Generally, you set Handled to true as part of an application event handler. You do so because the user action that initiated the event is considered appropriately handled by the other code that is defined in that event handler. You can still choose to respond to the event in the handler without setting Handled to true; however, know that other objects in the event route will then receive the event and invoke their own event handlers after the current event handler is exited.

For exceptional cases, you can register handlers for a routed event that can act even if Handled is set to true in the event data. However, use caution if you use this handler registration technique. The Handled concept is intended as a coding pattern to prevent spurious or repetitive handling of the same event in a complex object tree, and acting on an already-handled event goes against this design. For more information, see AddHandler.

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.