Button.IsDefaulted Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a value that indicates whether a Button is the button that is activated when a user presses ENTER.
public:
property bool IsDefaulted { bool get(); };
public bool IsDefaulted { get; }
member this.IsDefaulted : bool
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
.
Examples
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.";
}
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
Remarks
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.
Note
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
.
Dependency Property Information
Identifier field | IsDefaultedProperty |
Metadata properties set to true |
None |
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기