Editare

Partajați prin


UIElement.ManipulationInertiaStarting Event

Definition

Occurs when the input device loses contact with the UIElement object during a manipulation and inertia begins.

public:
 event EventHandler<System::Windows::Input::ManipulationInertiaStartingEventArgs ^> ^ ManipulationInertiaStarting;
public event EventHandler<System.Windows.Input.ManipulationInertiaStartingEventArgs> ManipulationInertiaStarting;
member this.ManipulationInertiaStarting : EventHandler<System.Windows.Input.ManipulationInertiaStartingEventArgs> 
Public Custom Event ManipulationInertiaStarting As EventHandler(Of ManipulationInertiaStartingEventArgs) 

Event Type

Examples

The following example shows the ManipulationInertiaStarting event handler and sets the desired deceleration for translation, expansion, and rotation that is used during inertia. This example is part of a larger example in Walkthrough: Creating Your First Touch Application.

void Window_InertiaStarting(object sender, ManipulationInertiaStartingEventArgs e)
{

    // Decrease the velocity of the Rectangle's movement by 
    // 10 inches per second every second.
    // (10 inches * 96 pixels per inch / 1000ms^2)
    e.TranslationBehavior.DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0);

    // Decrease the velocity of the Rectangle's resizing by 
    // 0.1 inches per second every second.
    // (0.1 inches * 96 pixels per inch / (1000ms^2)
    e.ExpansionBehavior.DesiredDeceleration = 0.1 * 96 / (1000.0 * 1000.0);

    // Decrease the velocity of the Rectangle's rotation rate by 
    // 2 rotations per second every second.
    // (2 * 360 degrees / (1000ms^2)
    e.RotationBehavior.DesiredDeceleration = 720 / (1000.0 * 1000.0);

    e.Handled = true;
}
Private Sub Window_InertiaStarting(ByVal sender As Object,
                                   ByVal e As ManipulationInertiaStartingEventArgs)

    ' Decrease the velocity of the Rectangle's movement by 
    ' 10 inches per second every second.
    ' (10 inches * 96 pixels per inch / 1000ms^2)
    e.TranslationBehavior.DesiredDeceleration = 10.0 * 96.0 / (1000.0 * 1000.0)

    ' Decrease the velocity of the Rectangle's resizing by 
    ' 0.1 inches per second every second.
    ' (0.1 inches * 96 pixels per inch / (1000ms^2)
    e.ExpansionBehavior.DesiredDeceleration = 0.1 * 96 / (1000.0 * 1000.0)

    ' Decrease the velocity of the Rectangle's rotation rate by 
    ' 2 rotations per second every second.
    ' (2 * 360 degrees / (1000ms^2)
    e.RotationBehavior.DesiredDeceleration = 720 / (1000.0 * 1000.0)

    e.Handled = True
End Sub

Remarks

The ManipulationInertiaStarting event occurs when the user lifts all of the fingers from the screen during a manipulation. For example, if a user "throws" a UIElement across a surface, the user will touch the UIElement to begin the action, move the finger across the screen for a short distance, and then release the UIElement. When the user releases the element, inertia begins and the ManipulationInertiaStarting event occurs. The UIElement continues to receive ManipulationDelta events to indicate that inertia is occurring on the element.

You can use this event to specify the behavior of the inertia. For example, you can set the initial velocity that is used when inertia begins. You can also specify the amount of inertia by setting the desired deceleration or by setting the desired placement. You can set these values for each type of manipulation (translation, expansion, or rotation) independently. For more information, see ManipulationInertiaStartingEventArgs.

For more information about manipulations, see the Input Overview. For an example of an application that responds to manipulations, see Walkthrough: Creating Your First Touch Application.

Routed Event Information

Identifier field ManipulationInertiaStartingEvent
Routing strategy Bubbling
Delegate EventHandler<TEventArgs> of type ManipulationInertiaStartingEventArgs.

Applies to