Bagikan melalui


InertiaTranslationBehavior Kelas

Definisi

Mengontrol deselerasi pada manipulasi terjemahan selama inertia.

public ref class InertiaTranslationBehavior
public class InertiaTranslationBehavior
type InertiaTranslationBehavior = class
Public Class InertiaTranslationBehavior
Warisan
InertiaTranslationBehavior

Contoh

Contoh berikut menunjukkan ManipulationInertiaStarting penanganan aktivitas dan mengatur deselerasi yang diinginkan untuk terjemahan, ekspansi, dan rotasi yang digunakan selama inertia. Contoh ini adalah bagian dari contoh yang lebih besar dalam Panduan: 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

Kelas InertiaTranslationBehavior menentukan bagaimana manipulasi terjemahan bersifat ketika inertia. TranslationBehavior Gunakan properti dalam ManipulationInertiaStarting peristiwa untuk melakukan hal berikut:

  • Tentukan kecepatan awal inertia saat dimulai dengan mengatur InitialVelocity properti.

  • Tentukan posisi manipulasi yang diinginkan saat inertia berakhir dengan mengatur DesiredDisplacement properti .

  • Tentukan deselerasi inertia yang diinginkan dengan mengatur DesiredDeceleration properti .

Atur DesiredDisplacementDesiredDecelerationatau , tetapi tidak keduanya. Saat Anda mengatur salah satu properti ini, properti lainnya diubah menjadi Double.NaN jika memiliki nilai.

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

Konstruktor

Nama Deskripsi
InertiaTranslationBehavior()

Menginisialisasi instans baru dari kelas InertiaTranslationBehavior.

Properti

Nama Deskripsi
DesiredDeceleration

Mendapatkan atau mengatur laju pergerakan linier melambat di unit independen perangkat (1/96 inci per unit) per milidetik kuadrat.

DesiredDisplacement

Mendapatkan atau mengatur gerakan linier manipulasi di akhir inertia.

InitialVelocity

Mendapatkan atau menetapkan laju awal pergerakan linier pada awal fase inertia.

Metode

Nama Deskripsi
Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetHashCode()

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()

Mendapatkan Type instans saat ini.

(Diperoleh dari Object)
MemberwiseClone()

Membuat salinan dangkal dari Objectsaat ini.

(Diperoleh dari Object)
ToString()

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Berlaku untuk