Skip to content

Commit a2437a0

Browse files
MichelMichelsKeboo
andauthored
Fix #2556 (#2563)
* Fix #2556 * Updating unit test * Fixing UI test Co-authored-by: Kevin Bost <[email protected]>
1 parent 1580dcc commit a2437a0

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

.github/actions/build-and-test/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ runs:
3333

3434
- name: Test
3535
shell: pwsh
36-
run: dotnet test ${{ inputs.solution }} --configuration ${{ inputs.buildConfiguration }} --no-build --verbosity detailed --blame-crash
36+
run: dotnet test ${{ inputs.solution }} --configuration ${{ inputs.buildConfiguration }} --no-build --verbosity normal --blame-crash
3737

3838
- name: Upload Screenshots
3939
if: ${{ always() }}

MaterialDesignThemes.UITests/WPF/TextBoxes/TextBoxTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,10 @@ public async Task VerticalContentAlignment_ProperlyAlignsText()
391391
");
392392

393393
var scrollViewer = await textBox.GetElement<ScrollViewer>("PART_ContentHost");
394-
Assert.Equal(VerticalAlignment.Top, await scrollViewer.GetVerticalAlignment());
394+
//The default for this changed with issue 2556.
395+
//It should be stretch so that the horizontal scroll bar is at the bottom and not
396+
//pushed to the bottom of the text.
397+
Assert.Equal(VerticalAlignment.Stretch, await scrollViewer.GetVerticalAlignment());
395398

396399
foreach (var alignment in Enum.GetValues<VerticalAlignment>())
397400
{

MaterialDesignThemes.Wpf.Tests/TextBoxTests.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@ public void DefaultVerticalAlignment_ShouldBeStretch()
1818
}
1919

2020
[StaFact]
21-
[Description("Issue 1301")]
22-
public void DefaultVerticalContentAlignment_ShouldBeTop()
21+
[Description("Issue 2556")]
22+
public void DefaultVerticalContentAlignment_ShouldBeStretch()
2323
{
24+
//The default was initially set to Top from issue 1301
25+
//However because TextBox contains a ScrollViewer this pushes
26+
//the horizontal scroll bar up by default, which is different
27+
//than the default WPF behavior.
2428
var textBox = new TextBox();
2529
textBox.ApplyDefaultStyle();
2630

27-
Assert.Equal(VerticalAlignment.Top, textBox.VerticalContentAlignment);
31+
Assert.Equal(VerticalAlignment.Stretch, textBox.VerticalContentAlignment);
2832
}
2933
}
3034
}

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TextBox.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<Setter Property="CaretBrush" Value="{DynamicResource PrimaryHueMidBrush}" />
5555
<Setter Property="SelectionBrush" Value="{DynamicResource PrimaryHueLightBrush}" />
5656
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
57-
<Setter Property="VerticalContentAlignment" Value="Top" />
57+
<Setter Property="VerticalContentAlignment" Value="Stretch" />
5858
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
5959
<Setter Property="AllowDrop" Value="true" />
6060
<Setter Property="Cursor" Value="Arrow" />
@@ -337,7 +337,6 @@
337337
<Setter TargetName="HelperTextTextBlock" Property="Margin" Value="16,0,0,0" />
338338
</Trigger>
339339
<Trigger Property="wpf:TextFieldAssist.HasOutlinedTextField" Value="True">
340-
<Setter Property="VerticalContentAlignment" Value="Top" />
341340
<Setter Property="BorderThickness" Value="1" />
342341
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignTextAreaBorder}" />
343342
<Setter Property="Padding" Value="16,16,12,16" />

0 commit comments

Comments
 (0)