Button.IsDefaulted Proprietà

Definizione

Ottiene un valore che indica se un Button è il pulsante attivato quando un utente preme INVIO.

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

Valore della proprietà

true se il pulsante è attivato quando l'utente preme INVIO; in caso contrario, false. Il valore predefinito è false.

Esempio

Nell'esempio seguente viene illustrato come determinare se la IsDefaulted proprietà è true relativa a un pulsante predefinito.

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

Commenti

La IsDefaulted proprietà è true quando la IsDefault proprietà è impostata su true e il controllo con stato attivo non accetta INVIO come input. Ad esempio, nella finestra di dialogo Esegui il pulsante OK è il pulsante predefinito. Quando lo stato attivo si trova sulla casella di testo, IsDefaulted sul pulsante OK è true perché un utente può attivare il pulsante premendo INVIO.

Nota

Se il pulsante predefinito ha lo stato attivo, IsDefaulted è false. Questo perché il OnKeyDown metodo gestisce INVIO e non è necessario impostare IsDefaulted su true.

Informazioni proprietà di dipendenza

Campo Identificatore IsDefaultedProperty
Proprietà dei metadati impostate su true Nessuno

Si applica a