diff --git a/src/MainDemo.Wpf/Toggles.xaml b/src/MainDemo.Wpf/Toggles.xaml index b608c89285..2700d706d9 100644 --- a/src/MainDemo.Wpf/Toggles.xaml +++ b/src/MainDemo.Wpf/Toggles.xaml @@ -452,6 +452,67 @@ + + + + Male + Female + Diverse + + + + + + + + + + + + + + + + + + + + + + + + + + Monthly + + + + + + + + + + + + + + diff --git a/src/MaterialDesign3.Demo.Wpf/Toggles.xaml b/src/MaterialDesign3.Demo.Wpf/Toggles.xaml index 2429ef3afd..44da7c0e82 100644 --- a/src/MaterialDesign3.Demo.Wpf/Toggles.xaml +++ b/src/MaterialDesign3.Demo.Wpf/Toggles.xaml @@ -23,6 +23,7 @@ + @@ -286,6 +287,70 @@ Grid.Column="0" Margin="0,24,0,0" Orientation="Horizontal"> + + + Male + Female + Diverse + + + + + + + + + + + + + + + + + + + + + + + + + + Monthly + + + + + + + + + + + + + + + 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 89ec715a60..a445dd52c0 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml @@ -959,4 +959,153 @@ + + + + + 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";