,

Manipulation Events

Manipulation events consolidate the touch activities of one or two fingers. Manipulation events combine individual touch point information, provided by the Touch.FrameReported event, and interpret them into a higher-level API with velocity, scaling, and translation information.

Moreover, unlike the Touch.FrameReported event, which provides touch notifications for your entire interface, a manipulation event is specific to the UIElement to which it is associated.

The manipulation events comprise three UIElement events, which are described in the following list:

Image ManipulationStartedRaised when the user touches the UIElement.

Image ManipulationDeltaRaised when a second touch point is placed on the element, and when a touch input changes position. This event can occur multiple times during a manipulation. For example, if the user drags a finger across the screen, the ManipulationDelta event occurs multiple times during the finger’s movement.

Image ManipulationCompletedRaised when the user’s finger, or fingers, leaves the UIElement, and when any inertia applied to the element is complete.

These three events are routed events (they subclass the RoutedEvent class). In case you are not familiar with routed events, a RoutedEvent can be handled by an ancestor element in the visual tree. RoutedEvents bubble upwards through the visual tree, until they are either handled, indicated by the Handled property of the event arguments, or reach the root element of the visual tree. This means that you can subscribe to a manipulation event at, for example, the page level, and it gives you the opportunity to handle manipulation events for all elements in the page.

As you might expect, a manipulation begins with the ManipulationStarted event, followed by zero or more ManipulationDelta events, and then a single ManipulationCompleted event.

The event arguments for all three manipulation events have the following shared properties:

Image OriginalSource (provided by the RoutedEvent base class)—This is the object that raised the manipulation event.

Image ManipulationContainerThis is the topmost enabled UIElement being touched. Touch points on different UIElements provide a separate succession of manipulation events and are distinguished by the ManipulationContainer property. The OriginalSource and ManipulationContainer properties are in most cases the same. Internally, ManipulationContainer is assigned to the OriginalSource property when a manipulation event is raised.

Image ManipulationOriginThis property, of type Point, indicates the location of the touch point relative to the top-left corner of the ManipulationContainer element. If two touch points exist on the element, the ManipulationOrigin property indicates the middle position between the two points.

Image HandledA property of type bool that allows you to halt the bubbling of the routed event up the visual tree.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.9.237