KeyEventArgs.Key KeyEventArgs.Key KeyEventArgs.Key KeyEventArgs.Key Property

Definición

Obtiene la tecla de teclado asociada al evento.Gets the keyboard key associated with the event.

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

Valor de propiedad

Key a la que hace referencia el evento.The Key referenced by the event.

Ejemplos

En el ejemplo siguiente KeyEventHandler KeyEventArgs se crea un objeto y se comprueba si la clave asociada Return al objeto es la clave.The following example creates a KeyEventHandler and checks whether the key associated with the KeyEventArgs is the Return key.

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

Se aplica a

Consulte también: