Skip to main content

Gets a value that indicates whether a Button is the button that is activated when a user presses ENTER.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

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

Property Value


true if the button is activated when the user presses ENTER; otherwise, false. The default is false.

The property is true when the property is set to true and the control that has focus does not accept ENTER as input. For example, in the Run dialog box, the OK button is the default button. When focus is on the text box, on the OK button is true because a user can activate the button by pressing ENTER.


If the default button has focus, is false. This is because the OnKeyDown method handles ENTER, and it is not necessary for to be set to true.

Identifier field


Metadata properties set to true


The following example shows how to determine whether the property is true for a default button.

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
.NET Framework
Available since 3.0
Return to top