(0) exportieren Drucken
Alle erweitern
EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

UIElement.MouseMove Event

July 28, 2014

Occurs when the coordinate position of the finger on the screen while touching a UIElement (or while a UIElement holds touch capture).

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

'Declaration
Public Event MouseMove As MouseEventHandler
<uiElement MouseMove="eventhandler"/>

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.

Be careful when you write code for a MouseMove handler. MouseMove will frequently occur while the user is interacting with the application or with the specific object area that has the handler. Any computationally or graphically intensive code in a MouseMove handler can potentially introduce a noticeable lag in how the user’s finger “draws” on the screen and how the application generally behaves.

The MouseMove event can be handled for any UIElement-derived class, such as Canvas, TextBlock, or Rectangle.

The MouseMove event is raised in response to a finger moving across the object's content area. If the finger enters the object's content area, the MouseEnter event precedes the MouseMove event for the object. The MouseMove event is not raised if the user’s finger did not actually move. For instance, MouseMove is not raised if the finger remains stationary, and an object with a MouseMove handler has its position animated or otherwise adjusted to move under the finger.

A UIElement that is capturing touch will receive MouseMove events for all movements of finger.

Routed Event Behavior

The MouseMove event is a bubbling event. This means that if multiple MouseMove 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 MouseEventArgs event data.

MouseMove and OnMouseMove

Controls that inherit MouseMove can provide handling for the event that acts as handler for all instances, by overriding the OnMouseMove method. As with direct handling of the event, there is no Handled property available, so OnMouseMove cannot be implemented in such a way that it suppresses further handling of the event through the Handled technique. However, OnMouseMove can be useful either for setting visual state, or for state properties and behavior related to the touchscreen. For instance, ButtonBase implements OnMouseMove as part of a larger behavior set that makes a button tap cancellable: if the user taps on a button but then moves their finger outside the button bounds, a tap is not invoked. For more information, see OnMouseMove.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Anzeigen:
© 2014 Microsoft