Share via


UIElement.ManipulationInertiaStarting Kejadian

Definisi

Terjadi ketika perangkat input kehilangan kontak dengan UIElement objek selama manipulasi dan inertia dimulai.

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) 

Jenis Acara

Contoh

Contoh berikut menunjukkan penanganan ManipulationInertiaStarting aktivitas dan mengatur deselerasi yang diinginkan untuk terjemahan, ekspansi, dan rotasi yang digunakan selama inertia. Contoh ini adalah bagian dari contoh yang lebih besar di Walkthrough: Membuat Aplikasi Sentuhan Pertama Anda.

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

Keterangan

Peristiwa terjadi ManipulationInertiaStarting ketika pengguna mengangkat semua jari dari layar selama manipulasi. Misalnya, jika pengguna "melempar" UIElement melintasi permukaan, pengguna akan menyentuh UIElement untuk memulai tindakan, memindahkan jari ke seluruh layar untuk jarak yang singkat, lalu melepaskan UIElement. Ketika pengguna merilis elemen , inertia dimulai dan ManipulationInertiaStarting peristiwa terjadi. terus UIElement menerima ManipulationDelta peristiwa untuk menunjukkan bahwa inertia terjadi pada elemen .

Anda dapat menggunakan peristiwa ini untuk menentukan perilaku inertia. Misalnya, Anda dapat mengatur kecepatan awal yang digunakan saat inertia dimulai. Anda juga dapat menentukan jumlah inertia dengan mengatur deselerasi yang diinginkan atau dengan mengatur penempatan yang diinginkan. Anda dapat mengatur nilai-nilai ini untuk setiap jenis manipulasi (terjemahan, ekspansi, atau rotasi) secara independen. Untuk informasi selengkapnya, lihat ManipulationInertiaStartingEventArgs.

Untuk informasi selengkapnya tentang manipulasi, lihat Gambaran Umum Input. Untuk contoh aplikasi yang merespons manipulasi, lihat Panduan: Membuat Aplikasi Sentuhan Pertama Anda.

Informasi Peristiwa Yang Dirutekan

Bidang pengidentifikasi ManipulationInertiaStartingEvent
Strategi perutean Menggelegak
Delegasikan EventHandler<TEventArgs> jenis ManipulationInertiaStartingEventArgs.

Berlaku untuk