When a manipulation begins, the ManipulationStarted
event is raised. The event handler accepts a ManipulationStartedEventArgs
parameter, as shown:
void HandleManipulationStarted(object sender, ManipulationStartedEventArgs e)
{
/* method body */
}
Contrary to the low-level TouchPoint
API, there is no need to store the ID of the touch point to track its motion. In fact, the manipulation events do not offer individual touch point information. If you need that information, the low-level TouchPoint
API may be more suitable.
During manipulation, the ManipulationDelta
event is raised when a touch point is added to the ManipulationContainer
element, or when the position of a touch point on the element changes. The event handler accepts a ManipulationDeltaEventArgs
parameter, as shown:
void HandleManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
/* method body */
}
ManipulationDeltaEventArgs
provides you with the most recent and the accumulated manipulation data. The following is a list of its properties, which have not yet been covered:
CumulativeManipulation—Gets the accumulated changes of the current manipulation, as a ManipulationDelta
instance. ManipulationDelta
has the following two properties:
Scale—A Point
indicating the horizontal and vertical scale amounts, relevant during multitouch manipulation.
Translate—A Point
indicating the horizontal and vertical positional offset.
DeltaManipulation—Gets the most recent changes of the current manipulation, as a ManipulationDelta
.
IsInertial—Gets whether the ManipulationDelta
event was raised while a finger had contact with the element. In my experience the value of this property is always false during the ManipulationDelta
event. This property is of more use during handling of the ManipulationCompleted
event, as you soon see.
Velocities—Gets the rates of the most recent changes to the manipulation. This property is of type ManipulationVelocities
, which is a class with the following two properties:
ExpansionVelocity—Gets a Point
representing the rate at which the manipulation was resized.
LinearVelocity—Gets a Point
representing the speed of the linear motion.
Inertia is applied automatically to a manipulation and is based on the velocity of the manipulation. Both the ManipulationCompletedEventArgs
and ManipulationStartedEventArgs
classes contain a Complete
method, which allows you to forcibly finish the manipulation event sequence, which raises the ManipulationComplete
event and prevents the application of inertia.
The ManipulationComplete
event handler accepts a ManipulationCompletedEventArgs
parameter, as shown:
void HandleManipulationCompleted(
object sender, ManipulationCompletedEventArgs e)
{
/* method body */
}
ManipulationCompletedEventArgs
provides you with the final velocities and overall manipulation data. The following is a list of its properties, which have not yet been covered:
FinalVelocities—Gets the final expansion and linear velocities for the manipulation.
IsInertial—Gets whether the ManipulationDelta
event occurred while a finger has contact with the element.
IsInertial—Gets whether the ManipulationDelta
event was raised while a finger had contact with the element. If the manipulation consisted of a single touch point, it is indicative of a flick gesture.
TotalManipulation—Gets a ManipulationDelta
object containing two Points
representing the total scale and translation values for the manipulation.
18.119.113.208