Skip to content

Commit 67f80c9

Browse files
zadjii-msftmcpiroman
authored andcommitted
Make sure to apply the theme on load of the application (microsoft#2107)
Fixes microsoft#1913. _AplyTheme raises an event for the IslandWindow to handle and actually apply the theme, so we don't _really_ need to worry about it, but we do need to worry for ContentDialogs.
1 parent 109232f commit 67f80c9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cascadia/TerminalApp/App.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ namespace winrt::TerminalApp::implementation
110110
_OpenNewTab(std::nullopt);
111111

112112
_tabContent.SizeChanged({ this, &App::_OnContentSizeChanged });
113+
114+
_ApplyTheme(_settings->GlobalSettings().GetRequestedTheme());
113115
}
114116

115117
App::~App()
@@ -153,6 +155,11 @@ namespace winrt::TerminalApp::implementation
153155
// xaml tree somehow.
154156
dialog.XamlRoot(_root.XamlRoot());
155157

158+
// IMPORTANT: Set the requested theme of the dialog, because the
159+
// PopupRoot isn't directly in the Xaml tree of our root. So the dialog
160+
// won't inherit our RequestedTheme automagically.
161+
dialog.RequestedTheme(_settings->GlobalSettings().GetRequestedTheme());
162+
156163
// Display the dialog.
157164
Controls::ContentDialogResult result = co_await dialog.ShowAsync(Controls::ContentDialogPlacement::Popup);
158165

@@ -740,7 +747,6 @@ namespace winrt::TerminalApp::implementation
740747
// - newTheme: The ElementTheme to apply to our elements.
741748
void App::_ApplyTheme(const Windows::UI::Xaml::ElementTheme& newTheme)
742749
{
743-
_root.RequestedTheme(newTheme);
744750
// Propagate the event to the host layer, so it can update its own UI
745751
_requestedThemeChangedHandlers(*this, newTheme);
746752
}

0 commit comments

Comments
 (0)