Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
IsDefaulted Property
Collapse the table of content
Expand the table of content

Button.IsDefaulted Property

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 Value

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

Identifier field


Metadata properties set to true


The IsDefaulted property is true when the IsDefault 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, IsDefaulted on the OK button is true because a user can activate the button by pressing ENTER.


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

The following example shows how to determine whether the IsDefaulted 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.";

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft