Skip to content

Commit 9ab978d

Browse files
Dock the overflow grid to bottom when Orientation=Vertical (#3000)
The overflow grid containing the overflow "button" was not correctly "moved" in the trigger handling the vertical scenario.
1 parent c8b5aff commit 9ab978d

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.ComponentModel;
2+
3+
namespace MaterialDesignThemes.UITests.WPF.ToolBars;
4+
5+
public class ToolBarTests : TestBase
6+
{
7+
public ToolBarTests(ITestOutputHelper output)
8+
: base(output)
9+
{
10+
}
11+
12+
[Description("Issue 2991")]
13+
[Theory]
14+
[InlineData(Orientation.Horizontal, Dock.Right)]
15+
[InlineData(Orientation.Vertical, Dock.Bottom)]
16+
public async Task ToolBar_OverflowGrid_RespectsOrientation(Orientation orientation, Dock expectedOverflowGridDock)
17+
{
18+
await using var recorder = new TestRecorder(App);
19+
20+
//Arrange
21+
var toolBarTray = await LoadXaml<ToolBarTray>($@"
22+
<ToolBarTray Orientation=""{orientation}"" DockPanel.Dock=""Top"">
23+
<ToolBar Style=""{{StaticResource MaterialDesignToolBar}}"">
24+
<Button Content=""{{materialDesign:PackIcon Kind=File}}""/>
25+
</ToolBar>
26+
</ToolBarTray>");
27+
var overflowGrid = await toolBarTray.GetElement<Grid>("OverflowGrid");
28+
29+
//Act
30+
Dock dock = await overflowGrid.GetProperty<Dock>(DockPanel.DockProperty);
31+
32+
//Assert
33+
Assert.Equal(expectedOverflowGridDock, dock);
34+
35+
recorder.Success();
36+
}
37+
}

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ToolBar.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters"
44
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf">
@@ -260,6 +260,7 @@
260260
<Setter TargetName="OverflowButton" Property="Style" Value="{StaticResource MaterialDesignToolBarVerticalOverflowButtonStyle}" />
261261
<Setter TargetName="OverflowGrid" Property="HorizontalAlignment" Value="Stretch" />
262262
<Setter TargetName="OverflowGrid" Property="VerticalAlignment" Value="Bottom" />
263+
<Setter TargetName="OverflowGrid" Property="DockPanel.Dock" Value="Bottom" />
263264
<Setter TargetName="OverflowPopup" Property="Placement" Value="Right" />
264265
<Setter TargetName="PART_ToolBarPanel" Property="Margin" Value="1,0,2,2" />
265266
<Setter TargetName="ToolBarHeader" Property="DockPanel.Dock" Value="Top" />

0 commit comments

Comments
 (0)