ContentDialog.CloseButtonText Property

Definition

Gets or sets the text to display on the close button.

public:
 property Platform::String ^ CloseButtonText { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring CloseButtonText();

void CloseButtonText(winrt::hstring value);
public string CloseButtonText { get; set; }
var string = contentDialog.closeButtonText;
contentDialog.closeButtonText = string;
Public Property CloseButtonText As String
<ContentDialog CloseButtonText="string"/>

Property Value

String

Platform::String

winrt::hstring

The text to display on the close button. To hide this button, set the text to null or an empty string. The default is an empty string.

Remarks

Every dialog should contain a safe, nondestructive action button that enables the user to confidently exit the dialog.

ContentDialog has a built-in close button that you can use by setting this property to a non-empty string. The close button is hidden when this property is set to an empty string or null.

The built-in close button lets you create the right user experience for all inputs including mouse, keyboard, touch, and game controller. The dialog will close when:

  • the user clicks or taps on the close button.
  • the user presses the system back button.
  • the user presses the ESC button on keyboard.
  • the user presses game controller B.

Invoking the close button returns ContentDialogResult.None, raises the CloseButtonClick event, which you can optionally handle, and invokes any CloseButtonCommand that is set.

Applies to

See also