UIElement.ManipulationInertiaStarting UIElement.ManipulationInertiaStarting UIElement.ManipulationInertiaStarting UIElement.ManipulationInertiaStarting Event

定义

当输入设备在操作期间与 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) 

示例

下面的示例显示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

注解

ManipulationInertiaStarting用户在操作过程中将所有手指从屏幕上提起时, 将发生此事件。The ManipulationInertiaStarting event occurs when the user lifts all of the fingers from the screen during a manipulation. 例如, 如果用户在表面上 "抛出UIElement ", 用户将UIElement触摸以开始操作, 在屏幕上将手指移动一小段距离UIElement, 然后释放。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. 用户释放元素时, 将开始惯性并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.

适用于