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.

Применяется к