MouseLeftButtonDown Event

UIElement.MouseLeftButtonDown Event

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

Occurs when a UIElement is tapped.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public event MouseButtonEventHandler MouseLeftButtonDown
<uiElement MouseLeftButtonDown="eventhandler"/>

The MouseLeftButtonDown event is raised when a UIElement is tapped. When the user’s finger is lifted off the touchscreen, the MouseLeftButtonUp event is raised. However, if the finger is moved over another object when the finger is lifted, the UIElement that received the MouseLeftButtonDown event will only receive the MouseLeftButtonUp event if that UI element has explicitly captured the touch event.

Use a handler based on MouseButtonEventHandler to handle this event. For more information on how to handle touch events, see Quickstart: Touch input for Windows Phone 8.

Touch capture is a concept whereby an object can continue to receive touch events, even if the finger is no longer over the object's bounding area. In order to request touch capture, the finger must be physically touching the screen. Therefore, a common point in code to call CaptureMouse is from within the MouseLeftButtonDown handler for a particular UIElement. For more information on touch capture and scenarios where it is useful, see Quickstart: Touch input for Windows Phone 8.

Routed Event Behavior

The MouseLeftButtonDown event is a bubbling event. This means that if multiple MouseLeftButtonDown event handlers are registered for a sequence of objects connected by parent-child relationships in the object tree, the event is received by each object in that relationship. The bubbling metaphor indicates that the event starts at the object that directly receives the input condition, and works its way up the object tree. For a bubbling event, the sender available to the event handler identifies the object where the event is handled, not necessarily the object that actually received the input condition that initiated the event. To get the object that initiated the event, use the OriginalSource value of the event's RoutedEventArgs event data.

MouseLeftButtonDown and OnMouseLeftButtonDown

Controls that inherit MouseLeftButtonDown can provide handling for the event that acts as handler for all instances, by overriding the OnMouseLeftButtonDown method. This might include marking the Handled value of the event as true, which has the effect of suppressing the MouseLeftButtonDown event on any instance of the control (and potentially any subclass of the control). The implementation also sets Handled, which generally prevents touch actions from being reported as a MouseLeftButtonDown event that could be handled by a button instance. This is done because the Click event is more meaningful for the control's intended purpose. For more information, see OnMouseLeftButtonDown.

You can also register handlers such that they are invoked even for already-handled routed events. For more information, see AddHandler.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2018 Microsoft