diff --git a/build/rules/Microsoft.UI.Xaml.Additional.targets b/build/rules/Microsoft.UI.Xaml.Additional.targets new file mode 100644 index 00000000000..dbd6eb3f35c --- /dev/null +++ b/build/rules/Microsoft.UI.Xaml.Additional.targets @@ -0,0 +1,16 @@ + + + + + + + diff --git a/dep/nuget/packages.config b/dep/nuget/packages.config index 5015d1ee970..09a9c4935d4 100644 --- a/dep/nuget/packages.config +++ b/dep/nuget/packages.config @@ -8,7 +8,8 @@ - + + diff --git a/src/cascadia/TerminalApp/TabBase.cpp b/src/cascadia/TerminalApp/TabBase.cpp index 54b25c48b08..6761ab3dac1 100644 --- a/src/cascadia/TerminalApp/TabBase.cpp +++ b/src/cascadia/TerminalApp/TabBase.cpp @@ -475,33 +475,36 @@ namespace winrt::TerminalApp::implementation // In GH#11294 we thought we'd still need to set // TabViewItemHeaderBackground manually, but GH#11382 discovered that // Background() was actually okay after all. + + const auto& tabItemResources{ TabViewItem().Resources() }; + TabViewItem().Background(deselectedTabBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderBackgroundSelected"), selectedTabBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderBackgroundPointerOver"), hoverTabBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderBackgroundPressed"), selectedTabBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderBackgroundSelected"), selectedTabBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderBackgroundPointerOver"), hoverTabBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderBackgroundPressed"), selectedTabBrush); // Similarly, TabViewItem().Foreground() sets the color for the text // when the TabViewItem isn't selected, but not when it is hovered, // pressed, dragged, or selected, so we'll need to just set them all // anyways. TabViewItem().Foreground(deselectedFontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderForeground"), deselectedFontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderForegroundSelected"), fontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderForegroundPointerOver"), fontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderForegroundPressed"), fontBrush); - - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonForeground"), deselectedFontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonForegroundPressed"), secondaryFontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonForegroundPointerOver"), fontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderPressedCloseButtonForeground"), fontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderPointerOverCloseButtonForeground"), fontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderSelectedCloseButtonForeground"), fontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonBackgroundPressed"), subtleFillColorTertiaryBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonBackgroundPointerOver"), subtleFillColorSecondaryBrush); - - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewButtonForegroundActiveTab"), fontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewButtonForegroundPressed"), fontBrush); - TabViewItem().Resources().Insert(winrt::box_value(L"TabViewButtonForegroundPointerOver"), fontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderForeground"), deselectedFontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderForegroundSelected"), fontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderForegroundPointerOver"), fontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderForegroundPressed"), fontBrush); + + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonForeground"), deselectedFontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonForegroundPressed"), secondaryFontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonForegroundPointerOver"), fontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderPressedCloseButtonForeground"), fontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderPointerOverCloseButtonForeground"), fontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderSelectedCloseButtonForeground"), fontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonBackgroundPressed"), subtleFillColorTertiaryBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonBackgroundPointerOver"), subtleFillColorSecondaryBrush); + + tabItemResources.Insert(winrt::box_value(L"TabViewButtonForegroundActiveTab"), fontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewButtonForegroundPressed"), fontBrush); + tabItemResources.Insert(winrt::box_value(L"TabViewButtonForegroundPointerOver"), fontBrush); _RefreshVisualState(); } @@ -537,13 +540,15 @@ namespace winrt::TerminalApp::implementation L"TabViewButtonForegroundPointerOver" }; + const auto& tabItemResources{ TabViewItem().Resources() }; + // simply clear any of the colors in the tab's dict for (const auto& keyString : keys) { auto key = winrt::box_value(keyString); - if (TabViewItem().Resources().HasKey(key)) + if (tabItemResources.HasKey(key)) { - TabViewItem().Resources().Remove(key); + tabItemResources.Remove(key); } } @@ -556,24 +561,20 @@ namespace winrt::TerminalApp::implementation } // Method Description: - // Toggles the visual state of the tab view item, - // so that changes to the tab color are reflected immediately + // BODGY + // - Toggles the requested theme of the tab view item, + // so that changes to the tab color are reflected immediately + // - Prior to MUX 2.8, we toggled the visual state here, but that seemingly + // doesn't work in 2.8. // Arguments: // - // Return Value: // - void TabBase::_RefreshVisualState() { - if (TabViewItem().IsSelected()) - { - VisualStateManager::GoToState(TabViewItem(), L"Normal", true); - VisualStateManager::GoToState(TabViewItem(), L"Selected", true); - } - else - { - VisualStateManager::GoToState(TabViewItem(), L"Selected", true); - VisualStateManager::GoToState(TabViewItem(), L"Normal", true); - } + const auto& reqTheme = TabViewItem().RequestedTheme(); + TabViewItem().RequestedTheme(ElementTheme::Light); + TabViewItem().RequestedTheme(ElementTheme::Dark); + TabViewItem().RequestedTheme(reqTheme); } - } diff --git a/src/common.nugetversions.props b/src/common.nugetversions.props index 19147f5e977..a3ac0f8ec9b 100644 --- a/src/common.nugetversions.props +++ b/src/common.nugetversions.props @@ -36,4 +36,7 @@ $(MSBuildThisFileDirectory)..\packages\Selenium.Support.3.5.0 + + + diff --git a/src/common.nugetversions.targets b/src/common.nugetversions.targets index 91a26fdf59a..e047b9931d2 100644 --- a/src/common.nugetversions.targets +++ b/src/common.nugetversions.targets @@ -16,6 +16,8 @@ "$(SolutionDir)dep\nuget\nuget.exe" $(SolutionDir)dep\nuget\packages.config + + $(MSBuildThisFileDirectory)..\packages\Microsoft.Web.WebView2.1.0.1661.34 - + + + @@ -86,7 +94,8 @@ - + +