Share via


ContentDialog.DefaultButton Property

Definition

Gets or sets a value that indicates which button on the dialog is the default action.

public:
 property ContentDialogButton DefaultButton { ContentDialogButton get(); void set(ContentDialogButton value); };
ContentDialogButton DefaultButton();

void DefaultButton(ContentDialogButton value);
public ContentDialogButton DefaultButton { get; set; }
var contentDialogButton = contentDialog.defaultButton;
contentDialog.defaultButton = contentDialogButton;
Public Property DefaultButton As ContentDialogButton

Property Value

A value of the enumeration. The default is None.

Remarks

You may optionally choose to differentiate one of the three buttons as the default button.

When you specify a default button:

  • The button receives the Accent Button visual treatment.
  • The button receives focus automatically when the dialog is opened unless the dialog's content contains a UI element that receives focus instead.
  • The button responds to the ENTER key automatically when it has focus.
    • When the user presses the ENTER key on the keyboard, the click event or command associated with the default button is invoked and the ContentDialogResult returns the value associated with the default button.
    • If the user has placed focus on a control that handles ENTER, the default button does not respond to presses of the ENTER key.

Applies to

See also