UIElement.ManipulationInertiaStarting 事件

定义

当输入设备在操作期间与 UIElement 对象失去联系且延时开始时发生。

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 事件处理程序,并设置在惯性期间使用的转换、扩展和旋转所需的减速。 此示例是 演练:创建第一个触摸应用程序中较大示例的一部分。

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 在操作过程中从屏幕上抬起所有手指时,会发生 该事件。 例如,如果用户在图面上“抛出”, UIElement 则用户将触摸 UIElement 以开始操作,在屏幕上移动手指一小段距离,然后松开 UIElement。 当用户释放元素时,惯性开始,并 ManipulationInertiaStarting 发生事件。 继续 UIElement 接收 ManipulationDelta 事件,以指示元素上发生了惯性。

可以使用此事件来指定惯性的行为。 例如,可以设置惯性开始时使用的初始速度。 还可以通过设置所需的减速或设置所需的放置来指定惯性量。 您可以单独为每种类型的操作设置这些值, (转换、扩展或旋转) 。 有关详细信息,请参阅 ManipulationInertiaStartingEventArgs

有关操作的详细信息,请参阅 输入概述。 有关响应操作的应用程序的示例,请参阅 演练:创建第一个触控应用程序

路由事件信息

标识符字段 ManipulationInertiaStartingEvent
路由策略 鼓 泡
委托 EventHandler<TEventArgs>类型ManipulationInertiaStartingEventArgs

适用于