Compartir por


Button.IsDefaulted Propiedad

Definición

Obtiene un valor que indica si es Button el botón que se activa cuando un usuario presiona ENTRAR.

public:
 property bool IsDefaulted { bool get(); };
public bool IsDefaulted { get; }
member this.IsDefaulted : bool
Public ReadOnly Property IsDefaulted As Boolean

Valor de propiedad

true si el botón se activa cuando el usuario presiona ENTRAR; de lo contrario, false. El valor predeterminado es false.

Ejemplos

En el ejemplo siguiente se muestra cómo determinar si la IsDefaulted propiedad es true para un botón predeterminado.

if (btnDefault.IsDefault)
{
    btnDefault.Content = "This is the default button.";
}
if (btnDefault.IsDefaulted)
{
    btnDefault.Content = "The button is defaulted.";
}
If (btnDefault.IsDefault = True) Then

    btnDefault.Content = "This is the default button."

    If (btnDefault.IsDefaulted = True) Then

        btnDefault.Content = "The button is defaulted."
    End If
End If

Comentarios

La IsDefaulted propiedad es true cuando la IsDefault propiedad se establece en true y el control que tiene el foco no acepta ENTRAR como entrada. Por ejemplo, en el cuadro de diálogo Ejecutar , el botón Aceptar es el botón predeterminado. Cuando el foco está en el cuadro de texto, IsDefaulted en el botón Aceptar es true porque un usuario puede activar el botón presionando ENTRAR.

Nota:

Si el botón predeterminado tiene el foco, IsDefaulted es false. Esto se debe a que el OnKeyDown método controla ENTRAR y no es necesario IsDefaulted establecer en true.

Información de la propiedad dependency

Elemento Importancia
Campo identificador IsDefaultedProperty
Propiedades de metadatos establecidas en true Ninguno

Se aplica a