UIElement.ManipulationInertiaStarting Event

Definition

当输入设备在操作期间与 UIElement 对象失去联系且延时开始时发生。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) 

Examples

下面的示例演示 ManipulationInertiaStarting 事件处理程序,并为惯性期间使用的转换、扩展和旋转设置所需的减速度。The following example shows the ManipulationInertiaStarting event handler and sets the desired deceleration for translation, expansion, and rotation that is used during inertia. 本示例摘自演练:创建您的第一个 Touch 应用程序中的一个更大的示例。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

当用户在操作过程中将所有手指从屏幕上提起时,将发生 ManipulationInertiaStarting 事件。The ManipulationInertiaStarting event occurs when the user lifts all of the fingers from the screen during a manipulation. 例如,如果用户在表面上 "抛出" UIElement,则用户将触摸 UIElement 以开始操作,在屏幕上将手指移动一小段,然后释放 UIElementFor 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. 当用户释放元素时,惯性将开始,并且 ManipulationInertiaStarting 事件发生。When the user releases the element, inertia begins and the ManipulationInertiaStarting event occurs. UIElement 继续接收 ManipulationDelta 事件,以指示元素上出现惯性。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. 有关详细信息,请参阅 ManipulationInertiaStartingEventArgsFor more information, see ManipulationInertiaStartingEventArgs.

有关操作的详细信息,请参阅输入概述For more information about manipulations, see the Input Overview. 有关响应操作的应用程序的示例,请参阅演练:创建你的第一个 Touch 应用程序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>类型ManipulationInertiaStartingEventArgsEventHandler<TEventArgs> of type ManipulationInertiaStartingEventArgs.

Applies to