UIElement.ManipulationInertiaStarting 事件

定義

當輸入裝置在操作期間失去和 UIElement 物件的通訊以及慣性開始時發生。

C#
public event EventHandler<System.Windows.Input.ManipulationInertiaStartingEventArgs> ManipulationInertiaStarting;

事件類型

範例

下列範例顯示 ManipulationInertiaStarting 事件處理常式,並設定慣性期間所使用的轉譯、展開和旋轉所需的減速。 本範例是逐步解說 :建立您的第一個觸控應用程式中較大範例的一部分。

C#
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;
}

備註

ManipulationInertiaStarting當使用者在操作期間從螢幕放開所有手指時,就會發生此事件。 例如,如果使用者在介面上「擲回」 UIElement ,使用者將會觸控 UIElement 以開始動作、將手指移至螢幕,以短距離移動手指,然後釋放 UIElement 。 當使用者釋放元素時,慣性就會開始,並 ManipulationInertiaStarting 發生 事件。 會 UIElement 繼續接收 ManipulationDelta 事件,以指出在 元素上發生慣性。

您可以使用這個事件來指定慣性的行為。 例如,您可以設定慣性開始時所使用的初始速度。 您也可以藉由設定所需的減速或設定所需的放置來指定慣性數量。 您可以針對每種操作類型設定這些值, (轉譯、展開或旋轉) 。 如需詳細資訊,請參閱ManipulationInertiaStartingEventArgs

如需操作的詳細資訊,請參閱 輸入概觀。 如需回應操作的應用程式範例,請參閱 逐步解說:建立您的第一個觸控應用程式

路由事件資訊

識別碼欄位 ManipulationInertiaStartingEvent
路由策略 鼓 泡
代理人 型別 EventHandler<TEventArgs>ManipulationInertiaStartingEventArgs

適用於

產品 版本
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9