Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent

# TUnit0031: Async void methods and lambdas are not allowed
dotnet_diagnostic.TUnit0031.severity = suggestion

[*.{cs,vb}]
#### Naming styles ####

Expand Down Expand Up @@ -188,3 +191,4 @@ dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion

36 changes: 18 additions & 18 deletions Directory.packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BluwolfIcons" Version="1.0.1" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<PackageVersion Include="Dragablz" Version="0.0.3.234" />
<PackageVersion Include="GitHubActionsTestLogger" Version="3.0.1" />
<PackageVersion Include="Humanizer" Version="2.14.1" />
<PackageVersion Include="Humanizer" Version="3.0.10" />
<PackageVersion Include="MahApps.Metro" Version="2.4.11" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.3.0" PrivateAssets="all" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="5.3.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.3.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="5.3.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="5.3.0" />
<PackageVersion Include="Microsoft.Composition" Version="1.0.31" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
<PackageVersion Include="Microsoft.Toolkit.MVVM" Version="7.1.2" />
<PackageVersion Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.142" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<PackageVersion Include="Polyfill" Version="8.8.1" />
<PackageVersion Include="Shouldly" Version="4.3.0" />
<PackageVersion Include="ShowMeTheXAML" Version="2.0.0" />
<PackageVersion Include="ShowMeTheXAML.AvalonEdit" Version="2.0.0" />
<PackageVersion Include="ShowMeTheXAML.MSBuild" Version="2.0.0" />
<PackageVersion Include="System.CommandLine" Version="2.0.2" />
<PackageVersion Include="ShowMeTheXAML" Version="2.1.1" />
<PackageVersion Include="ShowMeTheXAML.AvalonEdit" Version="2.1.1" />
<PackageVersion Include="ShowMeTheXAML.MSBuild" Version="2.1.1" />
<PackageVersion Include="System.CommandLine" Version="2.0.9" />
<PackageVersion Include="System.Memory" Version="4.6.3" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="System.ValueTuple" Version="4.6.1" />
<PackageVersion Include="System.ValueTuple" Version="4.6.2" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="TUnit" Version="1.9.45" />
<PackageVersion Include="VirtualizingWrapPanel" Version="1.5.8" />
<PackageVersion Include="XAMLTest" Version="1.3.1-ci662" />
<PackageVersion Include="TUnit" Version="1.53.0" />
<PackageVersion Include="VirtualizingWrapPanel" Version="2.5.1" />
<PackageVersion Include="XAMLTest" Version="1.3.1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "10.0.102",
"version": "10.0.301",
"rollForward": "latestMinor"
},
"test": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@
PopupAnimation="Fade"
RelativeHorizontalOffset="-6"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Tag="{DynamicResource MaterialDesign.Brush.Background}"
Tag="{DynamicResource MaterialDesign.Brush.ComboBox.DropDown.Background}"
UpVerticalOffset="15"
UseLayoutRounding="{TemplateBinding UseLayoutRounding}"
VerticalOffset="0">
Expand All @@ -557,7 +557,7 @@
<ContentControl>
<ScrollViewer MinHeight="1"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
Background="{Binding Background, ElementName=PART_Popup}">
Background="Transparent">
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</ContentControl>
Expand Down Expand Up @@ -796,8 +796,8 @@
<Condition SourceName="PART_Popup" Property="wpf:ColorZoneAssist.Mode" Value="Standard" />
</MultiTrigger.Conditions>
<Setter Property="TextElement.Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" />
<Setter TargetName="PART_Popup" Property="Background" Value="{Binding Tag, RelativeSource={RelativeSource Self}, Converter={x:Static converters:RemoveAlphaBrushConverter.Instance}}" />
<Setter TargetName="PART_Popup" Property="Tag" Value="{DynamicResource MaterialDesign.Brush.Background}" />
<Setter TargetName="PART_Popup" Property="Background" Value="{Binding Tag, RelativeSource={RelativeSource Self}}" />
<Setter TargetName="PART_Popup" Property="Tag" Value="{DynamicResource MaterialDesign.Brush.ComboBox.DropDown.Background}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.FilledBackground" ResourceKey="White100" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.HoverBackground" ResourceKey="White100" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.OutlineInactiveBorder" ResourceKey="White200" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.DropDown.Background" ResourceKey="Neutral100" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.Popup.DarkBackground" ResourceKey="Neutral100" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.Popup.DarkForeground" ResourceKey="Neutral900" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.Popup.LightBackground" ResourceKey="Neutral900" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@
<Grid MaxHeight="{TemplateBinding MaxDropDownHeight}" UseLayoutRounding="True">
<AdornerDecorator CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}">
<Border x:Name="shadow"
Background="{DynamicResource MaterialDesign.Brush.Background}"
Background="{DynamicResource MaterialDesign.Brush.ComboBox.DropDown.Background}"
BorderThickness="1"
CornerRadius="2"
Effect="{DynamicResource MaterialDesignShadowDepth2}" />
</AdornerDecorator>
<Border x:Name="dropDownBorder"
MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridCell}}"
Margin="{Binding ElementName=shadow, Path=Margin, Mode=OneWay}"
Background="Transparent"
Background="{DynamicResource MaterialDesign.Brush.ComboBox.DropDown.Background}"
BorderBrush="{DynamicResource MaterialDesign.Brush.DataGrid.ComboBoxHover}"
BorderThickness="1"
CornerRadius="2">
Expand Down Expand Up @@ -285,15 +285,15 @@
<Grid MaxHeight="{TemplateBinding MaxDropDownHeight}" UseLayoutRounding="True">
<AdornerDecorator CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}">
<Border x:Name="shadow"
Background="{DynamicResource MaterialDesign.Brush.Background}"
Background="{DynamicResource MaterialDesign.Brush.ComboBox.DropDown.Background}"
BorderThickness="1"
CornerRadius="2"
Effect="{DynamicResource MaterialDesignShadowDepth2}" />
</AdornerDecorator>
<Border x:Name="dropDownBorder"
MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=DataGridCell}}"
Margin="{Binding ElementName=shadow, Path=Margin, Mode=OneWay}"
Background="Transparent"
Background="{DynamicResource MaterialDesign.Brush.ComboBox.DropDown.Background}"
BorderBrush="{DynamicResource MaterialDesign.Brush.DataGrid.ComboBoxHover}"
BorderThickness="1"
CornerRadius="2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.FilledBackground" ResourceKey="Black50" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.HoverBackground" ResourceKey="Black100" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.OutlineInactiveBorder" ResourceKey="Black200" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.DropDown.Background" ResourceKey="Neutral900" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.Popup.DarkBackground" ResourceKey="Neutral100" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.Popup.DarkForeground" ResourceKey="Neutral900" />
<colors:StaticResource x:Key="MaterialDesign.Brush.ComboBox.Popup.LightBackground" ResourceKey="Neutral900" />
Expand Down
9 changes: 9 additions & 0 deletions src/MaterialDesignToolkit.ResourceGeneration/ThemeColors.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@
},
"alternateKeys": []
},
{
"name": "MaterialDesign.Brush.ComboBox.DropDown.Background",
"themeValues": {
"light": "Neutral900",
"dark": "Neutral100"
},
"alternateKeys": [],
"obsoleteKeys": []
},
{
"name": "MaterialDesign.Brush.ComboBox.Popup.DarkBackground",
"themeValues": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

<ItemGroup>
<Using Include="MaterialDesignThemes.Wpf" />
<Using Include="MaterialDesignThemes.Tests.TUnit"/>
<Using Include="XamlTest" />
</ItemGroup>

Expand Down
72 changes: 0 additions & 72 deletions tests/MaterialDesignThemes.UITests/TUnit/IsCloseToExtensions.cs

This file was deleted.

1 change: 1 addition & 0 deletions tests/MaterialDesignThemes.UITests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
[assembly: GenerateHelpers(typeof(DrawerHost))]
[assembly: GenerateHelpers(typeof(NumericUpDown))]
[assembly: GenerateHelpers(typeof(PopupBox))]
[assembly: GenerateHelpers(typeof(ComboBoxPopup))]
[assembly: GenerateHelpers(typeof(SmartHint))]
[assembly: GenerateHelpers(typeof(TimePicker))]
[assembly: GenerateHelpers(typeof(TreeListView))]
Expand Down
30 changes: 30 additions & 0 deletions tests/MaterialDesignThemes.UITests/WPF/ComboBoxes/ComboBoxTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Windows.Media;
using MaterialDesignThemes.UITests.WPF.TextBoxes;

namespace MaterialDesignThemes.UITests.WPF.ComboBoxes;
Expand Down Expand Up @@ -269,4 +270,33 @@ public async Task ComboBox_BorderShouldDependOnAppliedStyle(string style, double
Thickness thickness = await border.GetBorderThickness();
await Assert.That(thickness).IsEqualTo(new Thickness(left, top, right, bottom));
}

[Test]
[Description("Issue 3887")]
public async Task ComboBox_UsesDropDownBackgroundResource_WhenBackgroundIsNotSet()
{
var stackPanel = await LoadXaml<StackPanel>($$"""
<StackPanel>
<ComboBox Width="200">
<ComboBox.Resources>
<SolidColorBrush x:Key="MaterialDesign.Brush.ComboBox.DropDown.Background"
Color="#CC336699" />
</ComboBox.Resources>
<ComboBoxItem Content="Android" />
<ComboBoxItem Content="iOS" />
<ComboBoxItem Content="Linux" />
</ComboBox>
</StackPanel>
""");

var comboBox = await stackPanel.GetElement<ComboBox>();
await comboBox.LeftClick(Position.RightCenter);


var popup = await Wait.For(async () => await comboBox.GetElement<ComboBoxPopup>("PART_Popup"));
Color? popupBackground = await popup.GetBackgroundColor();

await Assert.That(popupBackground).IsNotNull();
await Assert.That(popupBackground).IsEqualTo((Color)ColorConverter.ConvertFromString("#CC336699"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public async Task ScrollingTabs_WithNavigationPanelLeft_ShouldCorrectlySetIsOver
Visibility navigationPanelVisibility = await navigationPanel.GetVisibility();

// Assert
await Assert.That(isOverflowing).IsEqualTo(true);
await Assert.That(isOverflowing).IsTrue();
await Assert.That(navigationPanelVisibility).IsEqualTo(Visibility.Visible);

recorder.Success();
Expand Down Expand Up @@ -322,7 +322,7 @@ public async Task ScrollingTabs_WithNavigationPanelRight_ShouldCorrectlySetIsOve
Visibility navigationPanelVisibility = await navigationPanel.GetVisibility();

// Assert
await Assert.That(isOverflowing).IsEqualTo(true);
await Assert.That(isOverflowing).IsTrue();
await Assert.That(navigationPanelVisibility).IsEqualTo(Visibility.Visible);

recorder.Success();
Expand Down
7 changes: 7 additions & 0 deletions tests/MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ private partial string GetXamlWrapPanel()
<TextBlock Text="ComboBox.HoverBorder" Background="{StaticResource MaterialDesign.Brush.ComboBox.HoverBorder}" />
<TextBlock Text="ComboBox.Border" Background="{StaticResource MaterialDesign.Brush.ComboBox.Border}" />
<TextBlock Text="ComboBox.OutlineBorder" Background="{StaticResource MaterialDesign.Brush.ComboBox.OutlineBorder}" />
<TextBlock Text="ComboBox.DropDown.Background" Background="{StaticResource MaterialDesign.Brush.ComboBox.DropDown.Background}" />
<TextBlock Text="ComboBox.Popup.DarkBackground" Background="{StaticResource MaterialDesign.Brush.ComboBox.Popup.DarkBackground}" />
<TextBlock Text="ComboBox.Popup.DarkForeground" Background="{StaticResource MaterialDesign.Brush.ComboBox.Popup.DarkForeground}" />
<TextBlock Text="ComboBox.Popup.LightBackground" Background="{StaticResource MaterialDesign.Brush.ComboBox.Popup.LightBackground}" />
Expand Down Expand Up @@ -345,6 +346,11 @@ private partial async Task AssertAllThemeBrushesSet(IVisualElement<WrapPanel> pa
Color? textBlockBackground = await textBlock.GetBackgroundColor();
await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.ComboBox.OutlineBorder"));
}
{
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"ComboBox.DropDown.Background\"]");
Color? textBlockBackground = await textBlock.GetBackgroundColor();
await Assert.That(textBlockBackground).IsEqualTo(await GetResourceColor("MaterialDesign.Brush.ComboBox.DropDown.Background"));
}
{
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"ComboBox.Popup.DarkBackground\"]");
Color? textBlockBackground = await textBlock.GetBackgroundColor();
Expand Down Expand Up @@ -955,6 +961,7 @@ private static IEnumerable<string> GetBrushResourceNames()
yield return "MaterialDesign.Brush.ComboBox.HoverBorder";
yield return "MaterialDesign.Brush.ComboBox.Border";
yield return "MaterialDesign.Brush.ComboBox.OutlineBorder";
yield return "MaterialDesign.Brush.ComboBox.DropDown.Background";
yield return "MaterialDesign.Brush.ComboBox.Popup.DarkBackground";
yield return "MaterialDesign.Brush.ComboBox.Popup.DarkForeground";
yield return "MaterialDesign.Brush.ComboBox.Popup.LightBackground";
Expand Down
Loading
Loading