Button.IsDefaulted Propiedad

Definición

Obtiene un valor que indica si Button es 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 se activa el botón cuando el usuario presiona ENTRAR; de lo contrario, false. De manera predeterminada, 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 == true)
{
    btnDefault.Content = "This is the default button.";
}
if (btnDefault.IsDefaulted == true)
{
    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 true en 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 ENTER y no es necesario IsDefaulted establecer trueen .

Información sobre propiedades de dependencia

Campo identificador IsDefaultedProperty
Propiedades de metadatos establecidas en true None

Se aplica a