Export (0) Print
Expand All
Expand Minimize

ContentElement.OnMouseLeftButtonDown Method

Invoked when an unhandled MouseLeftButtonDown routed event is raised on this element. Implement this method to add class handling for this event.

Namespace: System.Windows
Assembly: PresentationCore (in presentationcore.dll)

protected virtual void OnMouseLeftButtonDown (
	MouseButtonEventArgs e
)
protected void OnMouseLeftButtonDown (
	MouseButtonEventArgs e
)
protected function OnMouseLeftButtonDown (
	e : MouseButtonEventArgs
)
You cannot use methods in XAML.

Parameters

e

The MouseButtonEventArgs that contains the event data. The event data reports that the left mouse button was pressed.

The MouseLeftButtonDown event appears to travel a bubbling route but actually travels in an indirect way. Mouse.MouseDown is the underlying event that is bubble routed, and each ContentElement along the event route uses identical handling to raise the direct routed event MouseLeftButtonDown. Although you can mark the MouseLeftButtonDown event as handled for purposes of this element, the handled state does not perpetuate to other elements along the event route. However, you might want to mark the event as handled in order to prevent general instance handlers (those that did not specify handledEventsToo) from being invoked.

The default implementation for general mouse event handling in ContentElement listens for Mouse.MouseDown and converts it to an appropriate local event. If you want to override this logic, you must create a derived class. In the static constructor of your derived class, register an alternative class handler for Mouse.MouseDown. You cannot change the mouse handling behavior of ContentElement by overriding OnMouseLeftButtonDown.

Alternatively, you can override this method in order to change event handling for a specific mouse state. Whether you choose to call the base implementation depends on your scenario. Failing to call base disables default input handling for that mouse event on ancestor classes that also expect to invoke OnMouseLeftButtonDown. For example, you can derive from Button and override OnMouseLeftButtonDown in your derived class without calling the base implementation; however, this override disables the Click event.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft