Share via


MouseButtonEventArgs.Handled Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets a value that marks the routed event as handled. A true value for Handled prevents most handlers along the event route from handling the same event again.

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

Syntax

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

Property Value

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

Remarks

A property named Handled exists on certain routed event data classes in Windows Phone, and setting the value to true influences behavior of the Windows Phone event system. If you set Handled to true, then the event will generally not be 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 deemed to be appropriately handled by the other code defined in that event handler. You can still choose to respond to the event in the handler without setting Handled to true, but be aware 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. This should be done with caution, because the Handled concept is intended as a system 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

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

MouseButtonEventArgs Class

System.Windows.Input Namespace

Other Resources

Events for Windows Phone 8