From 11783c75a82038b6bce9b497dd40d9c4c56e7e70 Mon Sep 17 00:00:00 2001 From: Yayo Razo Date: Wed, 15 Jul 2026 16:09:10 -0600 Subject: [PATCH] fix(dns): scope leaked ToggleButton style and theme the ComboBox dropdown popup (#4835) Co-authored-by: Chris Titus --- pester/xaml.Tests.ps1 | 21 ++++++++++++++++++++ xaml/inputXML.xaml | 46 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 60 insertions(+), 7 deletions(-) diff --git a/pester/xaml.Tests.ps1 b/pester/xaml.Tests.ps1 index c272148f..887fe28c 100644 --- a/pester/xaml.Tests.ps1 +++ b/pester/xaml.Tests.ps1 @@ -271,6 +271,27 @@ Describe "XAML document" { } } + It "scopes toggle button styles without leaking into combo boxes" { + $resources = $script:xaml.SelectSingleNode('//*[local-name()="Window.Resources"]') + $implicitToggleStyles = @($resources.SelectNodes('./*[local-name()="Style"][@TargetType="ToggleButton" or @TargetType="{x:Type ToggleButton}"][not(@x:Key)]', $script:xamlNamespace)) + $tabStyle = $resources.SelectSingleNode('./*[local-name()="Style"][@x:Key="TabToggleButton"]', $script:xamlNamespace) + $comboToggleStyle = $resources.SelectSingleNode('./*[local-name()="Style"][@x:Key="ComboBoxToggleButtonStyle"]', $script:xamlNamespace) + $comboStyle = $resources.SelectSingleNode('./*[local-name()="Style"][@TargetType="ComboBox"]') + $comboToggle = $comboStyle.SelectSingleNode('.//*[local-name()="ToggleButton"][@Name="ToggleButton"]') + $comboItemStyle = $resources.SelectSingleNode('./*[local-name()="Style"][@TargetType="ComboBoxItem"]') + $navButtons = @($script:xaml.SelectNodes('//*[local-name()="StackPanel"][@Name="NavDockPanel"]/*[local-name()="ToggleButton"]')) + + $implicitToggleStyles | Should -BeNullOrEmpty + $tabStyle | Should -Not -BeNullOrEmpty + $comboToggleStyle | Should -Not -BeNullOrEmpty + $comboToggle.GetAttribute("Style") | Should -Be "{StaticResource ComboBoxToggleButtonStyle}" + $comboItemStyle | Should -Not -BeNullOrEmpty + $navButtons.Count | Should -Be 5 + foreach ($navButton in $navButtons) { + $navButton.GetAttribute("Style") | Should -Be "{StaticResource TabToggleButton}" + } + } + It "uses state-aware maximize and restore icons" { $themes = Get-WinUtilConfigObject -Name "themes" $minimizeButton = $script:xaml.SelectSingleNode('//*[local-name()="Button"][@Name="WPFMinimizeButton"]') diff --git a/xaml/inputXML.xaml b/xaml/inputXML.xaml index 12c28c5f..0e83dfd0 100644 --- a/xaml/inputXML.xaml +++ b/xaml/inputXML.xaml @@ -248,6 +248,17 @@ + + - -