Round and style buttons on close all tabs dialog (#4401)

This commit also fixes default buttons and default button styling
in all other dialogs and properly hooks up ESC and Enter for the
Close dialog.

Closes #4307.
Closes #3379.
This commit is contained in:
Kayla Cinnamon 2020-01-30 15:51:43 -08:00 committed by GitHub
parent 5c5471a34b
commit 4f61906b14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 16 deletions

View file

@ -30,20 +30,6 @@ the MIT License. See LICENSE in the project root for license information. -->
<Setter Property="Background" Value="{ThemeResource ApplicationPageBackgroundThemeBrush}" />
</Style>
<!-- Manually theme the CloseButton of a ContentDialog. We
need to do this, because for whatever reason, if we show a
ContentDialog when the app theme is opposite the system
theme, the buttons will appear transparent. This only
applies to the Close button of the dialog, since we're only
using the Close button of the dialog. If we ever add other
dialogs with more buttons, we'll probably want to make sure
the buttons are styled differently. -->
<Style TargetType="ContentDialog">
<!-- the value `AccentButtonStyle` is taken straight
from the ContentDialog source -->
<Setter Target="CloseButtonStyle" Value="{StaticResource AccentButtonStyle}" />
</Style>
<!-- We need to manually create the error text brush as a
theme-dependent brush. SystemControlErrorTextForegroundBrush
is unfortunately static. -->

View file

@ -279,6 +279,7 @@ namespace winrt::TerminalApp::implementation
dialog.Title(winrt::box_value(title));
dialog.Content(winrt::box_value(warningsTextBlock));
dialog.CloseButtonText(buttonText);
dialog.DefaultButton(Controls::ContentDialogButton::Close);
_ShowDialog(nullptr, dialog);
}
@ -315,6 +316,7 @@ namespace winrt::TerminalApp::implementation
dialog.Title(winrt::box_value(title));
dialog.Content(winrt::box_value(warningsTextBlock));
dialog.CloseButtonText(buttonText);
dialog.DefaultButton(Controls::ContentDialogButton::Close);
_ShowDialog(nullptr, dialog);
}

View file

@ -196,6 +196,7 @@ namespace winrt::TerminalApp::implementation
dialog.Title(winrt::box_value(title));
dialog.Content(winrt::box_value(message));
dialog.CloseButtonText(buttonText);
dialog.DefaultButton(WUX::Controls::ContentDialogButton::Close);
_showDialogHandlers(*this, dialog);
}
@ -280,6 +281,7 @@ namespace winrt::TerminalApp::implementation
dialog.Title(winrt::box_value(title));
dialog.Content(aboutTextBlock);
dialog.CloseButtonText(buttonText);
dialog.DefaultButton(WUX::Controls::ContentDialogButton::Close);
_showDialogHandlers(*this, dialog);
}
@ -295,13 +297,14 @@ namespace winrt::TerminalApp::implementation
{
auto title = RS_(L"CloseWindowWarningTitle");
auto primaryButtonText = RS_(L"CloseAll");
auto secondaryButtonText = RS_(L"Cancel");
auto closeButtonText = RS_(L"Cancel");
WUX::Controls::ContentDialog dialog;
dialog.Title(winrt::box_value(title));
dialog.CloseButtonText(closeButtonText);
dialog.PrimaryButtonText(primaryButtonText);
dialog.SecondaryButtonText(secondaryButtonText);
dialog.DefaultButton(WUX::Controls::ContentDialogButton::Primary);
auto token = dialog.PrimaryButtonClick({ this, &TerminalPage::_CloseWarningPrimaryButtonOnClick });
_showDialogHandlers(*this, dialog);