Este artigo foi traduzido por máquina. Para visualizar o arquivo em inglês, marque a caixa de seleção Inglês. Você também pode exibir o texto Em inglês em uma janela pop-up, movendo o ponteiro do mouse sobre o texto.
Tradução
Inglês

Evento UIElement.PreviewMouseLeftButtonDown

 

Ocorre quando o botão esquerdo do mouse é pressionado enquanto o ponteiro do mouse está sobre este elemento.

Namespace:   System.Windows
Assembly:  PresentationCore (em PresentationCore.dll)

public event MouseButtonEventHandler PreviewMouseLeftButtonDown

Although this seems to follow a tunneling route through an element tree, it actually is a direct routed event that is raised and reraised along the element tree by each T:System.Windows.UIElement.

This event is one of several related events that report the mouse-button specifics of an underlying E:System.Windows.Input.Mouse.PreviewMouseDown event, which is an attached event that is processed by each element along an event route.

The event data of this event exposes the event data of the underlying E:System.Windows.Input.Mouse.PreviewMouseDown event. If that event is marked as handled along the event route, the mouse-button specific events are still raised; however, handlers of the mouse-button specific events must be added by explicitly calling M:System.Windows.UIElement.AddHandler(System.Windows.RoutedEvent,System.Delegate), with the option to handle events that are already marked as handled, in order to be listeners to the event. If you mark E:System.Windows.UIElement.PreviewMouseLeftButtonDown handled, you are essentially marking E:System.Windows.Input.Mouse.PreviewMouseDown handled for all further listeners along the route, and on all related events. This possibly includes class-handler generated events such as E:System.Windows.Controls.Control.PreviewMouseDoubleClick.

Conceptually, think of this event (and other mouse-button events on T:System.Windows.UIElement) to be a mouse "service" (with the service definition provided by the T:System.Windows.Input.Mouse class). The event adds the convenience of not needing to check the mouse button states (left-right, up-down) of the original mouse events in the event data. For more advanced scenarios, such as checking for states of non-standard buttons, you might need to use the TLA#tla_api#plural on the T:System.Windows.Input.Mouse class rather than those on T:System.Windows.UIElement.

Identifier field

PreviewMouseLeftButtonDownEvent

Routing strategy

Direct

Delegate

MouseButtonEventHandler

  • Override M:System.Windows.UIElement.OnPreviewMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs) to implement class handling for this event in derived classes.

.NET Framework
Disponível desde 3.0
Retornar ao início
Mostrar: