From 82c4904a95c822f67c174b3107fe72a2f4b21f76 Mon Sep 17 00:00:00 2001 From: Corvin <43533385+corvinsz@users.noreply.github.com> Date: Wed, 17 Jun 2026 19:51:10 +0200 Subject: [PATCH 1/3] feat: add new SegmentedListBox style --- .../Themes/MaterialDesignTheme.ListBox.xaml | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml index 89ec715a60..0c7ad18a52 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml @@ -959,4 +959,154 @@ + + + + + From 4aac5d603ffc84a89a1e31c2499a1f5ef41c9172 Mon Sep 17 00:00:00 2001 From: Corvin <43533385+corvinsz@users.noreply.github.com> Date: Wed, 17 Jun 2026 19:51:55 +0200 Subject: [PATCH 2/3] docs: add examples of SegmentedListBoxStyle to demo app --- src/MainDemo.Wpf/Toggles.xaml | 59 +++++++++++++++++++++ src/MaterialDesign3.Demo.Wpf/Toggles.xaml | 63 +++++++++++++++++++++++ 2 files changed, 122 insertions(+) diff --git a/src/MainDemo.Wpf/Toggles.xaml b/src/MainDemo.Wpf/Toggles.xaml index b608c89285..823f2a9bd4 100644 --- a/src/MainDemo.Wpf/Toggles.xaml +++ b/src/MainDemo.Wpf/Toggles.xaml @@ -452,6 +452,65 @@ + + + + Male + Female + Diverse + + + + + + + + + + + + + + + + + + + + + + + + + + Monthly + + + + + + + + + + + + + + diff --git a/src/MaterialDesign3.Demo.Wpf/Toggles.xaml b/src/MaterialDesign3.Demo.Wpf/Toggles.xaml index 2429ef3afd..9a72eac4c9 100644 --- a/src/MaterialDesign3.Demo.Wpf/Toggles.xaml +++ b/src/MaterialDesign3.Demo.Wpf/Toggles.xaml @@ -23,6 +23,7 @@ + @@ -286,6 +287,68 @@ Grid.Column="0" Margin="0,24,0,0" Orientation="Horizontal"> + + + Male + Female + Diverse + + + + + + + + + + + + + + + + + + + + + + + + + + Monthly + + + + + + + + + + + + + + + From 3564fdfa62e6d3008e0e2c551404a8953b3c2c2a Mon Sep 17 00:00:00 2001 From: Kevin Bost Date: Thu, 18 Jun 2026 21:44:22 -0700 Subject: [PATCH 3/3] feat: add dedicated brush for SegmentedListBox background Introduces MaterialDesign.Brush.ListBox.SegmentedBackground to allow independent styling of SegmentedListBox backgrounds. Previously, these controls shared the Chip background brush. This change also includes updates to the theme generator and demo applications to utilize the new resource. --- src/MainDemo.Wpf/Toggles.xaml | 6 ++++-- src/MaterialDesign3.Demo.Wpf/Toggles.xaml | 6 ++++-- .../ResourceDictionaryExtensions.g.cs | 3 +++ src/MaterialDesignThemes.Wpf/Theme.g.cs | 20 +++++++++++++++++++ .../ThemeExtensions.g.cs | 2 ++ .../Themes/MaterialDesignTheme.Dark.xaml | 1 + .../Themes/MaterialDesignTheme.Light.xaml | 1 + .../Themes/MaterialDesignTheme.ListBox.xaml | 7 +++---- .../ThemeColors.json | 4 +++- .../WPF/Theme/ThemeTests.g.cs | 14 +++++++++++++ 10 files changed, 55 insertions(+), 9 deletions(-) diff --git a/src/MainDemo.Wpf/Toggles.xaml b/src/MainDemo.Wpf/Toggles.xaml index 823f2a9bd4..2700d706d9 100644 --- a/src/MainDemo.Wpf/Toggles.xaml +++ b/src/MainDemo.Wpf/Toggles.xaml @@ -454,7 +454,8 @@ - + Male Female Diverse @@ -462,7 +463,8 @@ - + diff --git a/src/MaterialDesign3.Demo.Wpf/Toggles.xaml b/src/MaterialDesign3.Demo.Wpf/Toggles.xaml index 9a72eac4c9..44da7c0e82 100644 --- a/src/MaterialDesign3.Demo.Wpf/Toggles.xaml +++ b/src/MaterialDesign3.Demo.Wpf/Toggles.xaml @@ -288,7 +288,8 @@ Margin="0,24,0,0" Orientation="Horizontal"> - + Male Female Diverse @@ -296,7 +297,8 @@ - + diff --git a/src/MaterialDesignThemes.Wpf/ResourceDictionaryExtensions.g.cs b/src/MaterialDesignThemes.Wpf/ResourceDictionaryExtensions.g.cs index e36e890f66..56a878fc38 100644 --- a/src/MaterialDesignThemes.Wpf/ResourceDictionaryExtensions.g.cs +++ b/src/MaterialDesignThemes.Wpf/ResourceDictionaryExtensions.g.cs @@ -31,6 +31,7 @@ private static partial void LoadThemeColors(ResourceDictionary resourceDictionar theme.CheckBoxes.Off = GetColor(resourceDictionary, "MaterialDesign.Brush.CheckBox.Off", "MaterialDesignBodyLight", "MaterialDesignCheckBoxOff", "MaterialDesignTextBoxBorder"); theme.Chips.Background = GetColor(resourceDictionary, "MaterialDesign.Brush.Chip.Background", "MaterialDesignChipBackground"); theme.Chips.OutlineBorder = GetColor(resourceDictionary, "MaterialDesign.Brush.Chip.OutlineBorder"); + theme.ListBoxes.SegmentedBackground = GetColor(resourceDictionary, "MaterialDesign.Brush.ListBox.SegmentedBackground", "MaterialDesignChipBackground"); theme.ColorZones.DarkBackground = GetColor(resourceDictionary, "MaterialDesign.Brush.ColorZone.DarkBackground"); theme.ColorZones.DarkForeground = GetColor(resourceDictionary, "MaterialDesign.Brush.ColorZone.DarkForeground"); theme.ColorZones.LightBackground = GetColor(resourceDictionary, "MaterialDesign.Brush.ColorZone.LightBackground"); @@ -144,6 +145,8 @@ private static partial void ApplyThemeColors(ResourceDictionary resourceDictiona SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Chip.Background", theme.Chips.Background); SetSolidColorBrush(resourceDictionary, "MaterialDesignChipBackground", theme.Chips.Background); SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Chip.OutlineBorder", theme.Chips.OutlineBorder); + SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.ListBox.SegmentedBackground", theme.ListBoxes.SegmentedBackground); + SetSolidColorBrush(resourceDictionary, "MaterialDesignChipBackground", theme.ListBoxes.SegmentedBackground); SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.ColorZone.DarkBackground", theme.ColorZones.DarkBackground); SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.ColorZone.DarkForeground", theme.ColorZones.DarkForeground); SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.ColorZone.LightBackground", theme.ColorZones.LightBackground); diff --git a/src/MaterialDesignThemes.Wpf/Theme.g.cs b/src/MaterialDesignThemes.Wpf/Theme.g.cs index d20d4e5ed1..1151bb2cff 100644 --- a/src/MaterialDesignThemes.Wpf/Theme.g.cs +++ b/src/MaterialDesignThemes.Wpf/Theme.g.cs @@ -17,6 +17,7 @@ public Theme() Cards = new(this); CheckBoxes = new(this); Chips = new(this); + ListBoxes = new(this); ColorZones = new(this); ComboBoxes = new(this); DataGrids = new(this); @@ -76,6 +77,8 @@ public ColorReference ValidationError public Chip Chips { get; set; } + public ListBox ListBoxes { get; set; } + public ColorZone ColorZones { get; set; } public ComboBox ComboBoxes { get; set; } @@ -289,6 +292,23 @@ public ColorReference OutlineBorder } + public class ListBox + { + private readonly Theme _theme; + public ListBox(Theme theme) + { + _theme = theme ?? throw new ArgumentNullException(nameof(theme)); + } + + private ColorReference _segmentedBackground; + public ColorReference SegmentedBackground + { + get => _theme.Resolve(_segmentedBackground); + set => _segmentedBackground = value; + } + + } + public class ColorZone { private readonly Theme _theme; diff --git a/src/MaterialDesignThemes.Wpf/ThemeExtensions.g.cs b/src/MaterialDesignThemes.Wpf/ThemeExtensions.g.cs index 13ba26a1f4..09af33bef0 100644 --- a/src/MaterialDesignThemes.Wpf/ThemeExtensions.g.cs +++ b/src/MaterialDesignThemes.Wpf/ThemeExtensions.g.cs @@ -36,6 +36,7 @@ public static partial void SetLightTheme(this Theme theme) theme.CheckBoxes.Off = BaseThemeColors.Black500; theme.Chips.Background = BaseThemeColors.Black50; theme.Chips.OutlineBorder = BaseThemeColors.Black100; + theme.ListBoxes.SegmentedBackground = BaseThemeColors.Black50; theme.ColorZones.DarkBackground = BaseThemeColors.Neutral100; theme.ColorZones.DarkForeground = BaseThemeColors.Neutral900; theme.ColorZones.LightBackground = BaseThemeColors.Neutral900; @@ -127,6 +128,7 @@ public static partial void SetDarkTheme(this Theme theme) theme.CheckBoxes.Off = BaseThemeColors.White500; theme.Chips.Background = BaseThemeColors.White50; theme.Chips.OutlineBorder = BaseThemeColors.White100; + theme.ListBoxes.SegmentedBackground = BaseThemeColors.White50; theme.ColorZones.DarkBackground = BaseThemeColors.Neutral100; theme.ColorZones.DarkForeground = BaseThemeColors.Neutral900; theme.ColorZones.LightBackground = BaseThemeColors.Neutral900; diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml index c0f104b5c7..b6a0ffa282 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Dark.xaml @@ -19,6 +19,7 @@ + diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml index 68dac171db..43d97f9d70 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Light.xaml @@ -19,6 +19,7 @@ + diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml index 0c7ad18a52..a445dd52c0 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml @@ -969,10 +969,11 @@ + - diff --git a/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json b/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json index 9f8172bd23..a6dc8a280e 100644 --- a/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json +++ b/src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json @@ -163,7 +163,9 @@ "light": "Black50", "dark": "White50" }, - "alternateKeys": [], + "alternateKeys": [ + "MaterialDesign.Brush.ListBox.SegmentedBackground" + ], "obsoleteKeys": [ "MaterialDesignChipBackground" ] diff --git a/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs b/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs index b7063d9a20..bdb40a32f1 100644 --- a/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs +++ b/tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs @@ -42,6 +42,7 @@ private partial string GetXamlWrapPanel() + @@ -130,6 +131,7 @@ private partial string GetXamlWrapPanel() + @@ -290,6 +292,11 @@ private partial async Task AssertAllThemeBrushesSet(IVisualElement pa Color? textBlockBackground = await textBlock.GetBackgroundColor(); await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.Chip.OutlineBorder")); } + { + IVisualElement textBlock = await panel.GetElement("[Text=\"ListBox.SegmentedBackground\"]"); + Color? textBlockBackground = await textBlock.GetBackgroundColor(); + await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.ListBox.SegmentedBackground")); + } { IVisualElement textBlock = await panel.GetElement("[Text=\"ColorZone.DarkBackground\"]"); Color? textBlockBackground = await textBlock.GetBackgroundColor(); @@ -730,6 +737,11 @@ private partial async Task AssertAllThemeBrushesSet(IVisualElement pa Color? textBlockBackground = await textBlock.GetBackgroundColor(); await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesignChipBackground")); } + { + IVisualElement textBlock = await panel.GetElement("[Text=\"MaterialDesignChipBackground\"]"); + Color? textBlockBackground = await textBlock.GetBackgroundColor(); + await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesignChipBackground")); + } { IVisualElement textBlock = await panel.GetElement("[Text=\"MaterialDesignBody\"]"); Color? textBlockBackground = await textBlock.GetBackgroundColor(); @@ -944,6 +956,7 @@ private static IEnumerable GetBrushResourceNames() yield return "MaterialDesign.Brush.CheckBox.Off"; yield return "MaterialDesign.Brush.Chip.Background"; yield return "MaterialDesign.Brush.Chip.OutlineBorder"; + yield return "MaterialDesign.Brush.ListBox.SegmentedBackground"; yield return "MaterialDesign.Brush.ColorZone.DarkBackground"; yield return "MaterialDesign.Brush.ColorZone.DarkForeground"; yield return "MaterialDesign.Brush.ColorZone.LightBackground"; @@ -1035,6 +1048,7 @@ private static IEnumerable GetObsoleteBrushResourceNames() yield return "MaterialDesignCheckBoxOff"; yield return "MaterialDesignTextBoxBorder"; yield return "MaterialDesignChipBackground"; + yield return "MaterialDesignChipBackground"; yield return "MaterialDesignBody"; yield return "MaterialDesignBodyLight"; yield return "MaterialDesignCheckBoxOff";