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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ResourceDictionary.MergedDictionaries>

<Style x:Key="MaterialDesignToolBarVerticalOverflowButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.ToolBar.Background}" />
<Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSource AncestorType=ToolBar}}" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="Template">
Expand Down Expand Up @@ -55,7 +55,7 @@
</Style>

<Style x:Key="MaterialDesignToolBarHorizontalOverflowButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.ToolBar.Background}" />
<Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSource AncestorType=ToolBar}}" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="Template">
Expand Down Expand Up @@ -187,7 +187,7 @@
CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}">
<Border x:Name="ToolBarSubMenuBorder"
Margin="1"
Background="{DynamicResource MaterialDesign.Brush.ToolBar.Background}"
Background="{TemplateBinding Background}"
BorderBrush="{DynamicResource MaterialDesign.Brush.ToolBar.Overflow.Border}"
BorderThickness="1"
CornerRadius="2"
Expand Down Expand Up @@ -246,7 +246,6 @@
<Setter TargetName="ToolBarSubMenuBorder" Property="Margin" Value="5,5,5,5" />
</Trigger>
<Trigger Property="Orientation" Value="Vertical">
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.ToolBar.Background}" />
<Setter TargetName="Grid" Property="Margin" Value="1,3,1,1" />
<Setter TargetName="MainPanelBorder" Property="Margin" Value="0,0,0,11" />
<Setter TargetName="OverflowButton" Property="Style" Value="{StaticResource MaterialDesignToolBarVerticalOverflowButtonStyle}" />
Expand Down
25 changes: 25 additions & 0 deletions tests/MaterialDesignThemes.UITests/WPF/ToolBars/ToolBarTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Windows.Media;


namespace MaterialDesignThemes.UITests.WPF.ToolBars;
Expand Down Expand Up @@ -30,4 +31,28 @@ public async Task ToolBar_OverflowGrid_RespectsOrientation(Orientation orientati

recorder.Success();
}

[Description("Issue 3694")]
[Test]
public async Task ToolBar_OverflowButton_InheritsCustomBackground()
{
await using var recorder = new TestRecorder(App);

//Arrange
var toolBarTray = await LoadXaml<ToolBarTray>(@"
<ToolBarTray DockPanel.Dock=""Top"">
<ToolBar Style=""{StaticResource MaterialDesignToolBar}"" Background=""Fuchsia"" OverflowMode=""Always"">
<Button Content=""{materialDesign:PackIcon Kind=File}""/>
</ToolBar>
</ToolBarTray>");
var overflowButton = await toolBarTray.GetElement<ToggleButton>("OverflowButton");

//Act
Color? overflowBackground = await overflowButton.GetBackgroundColor();

//Assert
await Assert.That(overflowBackground).IsEqualTo(Colors.Fuchsia);

recorder.Success();
}
}
Loading