Hello,
I have ContentDialog with primary button and close button.
I want that when I press primary button the dialog doesnt be closed.
It should be closed only if close button was clicked.
Below my code:
private async void btnSave_Click(object sender, RoutedEventArgs e)
{
ContentDialog saveDialog = new ContentDialog
{
CloseButtonText = "Cancel",
IsPrimaryButtonEnabled = true,
PrimaryButtonText = "Save",
};
ContentDialogResult result = await saveDialog.ShowAsync();
if (result == ContentDialogResult.Primary)
{
I want run some code here, but does not close the ContentDialog
}
else
{
The ContentDialog should be closed
// The user clicked the CLoseButton, pressed ESC, Gamepad B, or the system back button.
// Do nothing.
}
}
Please write, how to code such task