KeyEventArgs.Key Propriété

Définition

Obtient la touche clavier associée à l’événement.

public:
 property System::Windows::Input::Key Key { System::Windows::Input::Key get(); };
public System.Windows.Input.Key Key { get; }
member this.Key : System.Windows.Input.Key
Public ReadOnly Property Key As Key

Valeur de propriété

Key

Key Référencé par l’événement.

Exemples

L’exemple suivant crée une KeyEventHandler clé et vérifie si la clé associée KeyEventArgs est la Return clé.

private void OnKeyDownHandler(object sender, KeyEventArgs e)
{
    if (e.Key == Key.Return)
    {
        textBlock1.Text = "You Entered: " + textBox1.Text;
    }
}
Private Sub OnKeyDownHandler(ByVal sender As Object, ByVal e As KeyEventArgs)
    If (e.Key = Key.Return) Then
        textBlock1.Text = "You Entered: " + textBox1.Text
    End If
End Sub

S’applique à

Voir aussi