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

適用於