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. 這個範例是逐步解說中較大範例的一部分:建立您的第一個觸控應用程式。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. 會繼續接收ManipulationDelta事件, 以指出在元素上發生慣性。 UIElementThe 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. 如需回應操作的應用程式範例, 請參閱逐步解說:建立您的第一個觸控應用程式。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 - 委派Delegate 型別 EventHandler<TEventArgs>ManipulationInertiaStartingEventArgsEventHandler<TEventArgs> of type ManipulationInertiaStartingEventArgs.

適用於