Skip to content

Commit 2cf1f9b

Browse files
authored
Removed separate MinHeight resources for text based controls (#10980)
1 parent 735166c commit 2cf1f9b

File tree

10 files changed

+45
-86
lines changed

10 files changed

+45
-86
lines changed

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Resources/Variables.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<!-- <Thickness x:Key="TextControlBorderThemeThicknessFocused">2</Thickness> -->
3434

3535
<system:Double x:Key="ContentControlFontSize">14</system:Double>
36-
<system:Double x:Key="TextControlThemeMinHeight">24</system:Double>
36+
<system:Double x:Key="TextControlThemeMinHeight">32</system:Double>
3737
<system:Double x:Key="TextControlThemeMinWidth">0</system:Double>
3838
<system:Double x:Key="TreeViewItemMultiSelectCheckBoxMinHeight">24</system:Double>
3939
<system:Double x:Key="TreeViewItemPresenterMargin">0</system:Double>

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ComboBox.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<Setter Property="HorizontalContentAlignment" Value="Left" />
4545
<Setter Property="VerticalContentAlignment" Value="Top" />
4646
<Setter Property="Cursor" Value="IBeam" />
47-
<Setter Property="MinHeight" Value="{DynamicResource TextBoxThemeMinHeight}" />
47+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
4848
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
4949
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
5050
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
@@ -569,7 +569,7 @@
569569
<Setter Property="HorizontalAlignment" Value="Stretch" />
570570
<Setter Property="VerticalAlignment" Value="Center" />
571571
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
572-
<Setter Property="VerticalContentAlignment" Value="Top" />
572+
<Setter Property="VerticalContentAlignment" Value="Center" />
573573
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
574574
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
575575
<Setter Property="Padding" Value="{DynamicResource ComboBoxPadding}" />

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/DatePicker.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
<Setter Property="Background" Value="{DynamicResource DatePickerBackground}" />
118118
<Setter Property="BorderBrush" Value="{DynamicResource TextControlElevationBorderBrush}" />
119119
<Setter Property="BorderThickness" Value="{StaticResource DatePickerBorderThickness}" />
120+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
120121
<Setter Property="HorizontalAlignment" Value="Stretch" />
121122
<Setter Property="VerticalAlignment" Value="Center" />
122123
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
@@ -188,7 +189,7 @@
188189
BorderThickness="{TemplateBinding BorderThickness}"
189190
Background="{TemplateBinding Background}"
190191
CornerRadius="{TemplateBinding Border.CornerRadius}"
191-
MinHeight="32">
192+
MinHeight="{TemplateBinding MinHeight}">
192193
</Border>
193194

194195
<DatePickerTextBox x:Name="PART_TextBox"

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/PasswordBox.xaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
<!-- <Thickness x:Key="PasswordBoxBorderThemeThickness">1,1,1,1</Thickness> -->
2727

2828
<Thickness x:Key="PasswordBoxBorderThemeThickness">1</Thickness>
29-
<!-- Instead of PasswordBoxThemeMinHeight, we need to use TextControlThemeMinHeight, but modifying that right now
30-
will affect the other styles as well. Once the remaining styles using it are fixed, will remove this resource -->
31-
<sys:Double x:Key="PasswordBoxThemeMinHeight">32</sys:Double>
3229

3330
<ContextMenu x:Key="DefaultPasswordBoxContextMenu">
3431
<MenuItem Command="ApplicationCommands.Paste" />
@@ -47,7 +44,7 @@
4744
<Setter Property="HorizontalContentAlignment" Value="Left" />
4845
<Setter Property="VerticalContentAlignment" Value="Top" />
4946
<Setter Property="Cursor" Value="IBeam" />
50-
<Setter Property="MinHeight" Value="{DynamicResource PasswordBoxThemeMinHeight}" />
47+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
5148
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
5249
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
5350
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RichTextBox.xaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212

1313
<!-- Deprecated RichTextBox Resources ( Used in .NET 9 ) -->
1414
<Thickness x:Key="RichTextBoxAccentBorderThemeThickness">0,0,0,1</Thickness>
15-
16-
<!-- Instead of RichTextBoxThemeMinHeight, we need to use TextControlThemeMinHeight, but modifying that right now
17-
will affect the other styles as well. Once the remaining styles using it are fixed, will remove this resource -->
18-
<system:Double x:Key="RichTextBoxThemeMinHeight">32</system:Double>
1915

2016
<Style x:Key="DefaultRichTextBoxStyle" TargetType="{x:Type RichTextBox}">
2117
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
@@ -30,7 +26,7 @@
3026
<Setter Property="HorizontalContentAlignment" Value="Left" />
3127
<Setter Property="VerticalContentAlignment" Value="Top" />
3228
<Setter Property="Cursor" Value="IBeam" />
33-
<Setter Property="MinHeight" Value="{DynamicResource RichTextBoxThemeMinHeight}" />
29+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
3430
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
3531
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
3632
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/TextBox.xaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
<!-- <Thickness x:Key="TextBoxClearButtonPadding">0,0,0,0</Thickness> -->
2727

2828
<system:Double x:Key="TextBoxIconFontSize">12</system:Double>
29-
<!-- Instead of TextBoxThemeMinHeight, we need to use TextControlThemeMinHeight, but modifying that right now
30-
will affect the other styles as well. Once the remaining styles using it are fixed, will remove this resource -->
31-
<system:Double x:Key="TextBoxThemeMinHeight">32</system:Double>
3229
<Thickness x:Key="TextBoxClearButtonMargin">0,4,4,4</Thickness>
3330
<Thickness x:Key="TextBoxClearButtonPadding">0,0,-2,0</Thickness>
3431

@@ -45,7 +42,7 @@
4542
<Setter Property="HorizontalContentAlignment" Value="Left" />
4643
<Setter Property="VerticalContentAlignment" Value="Top" />
4744
<Setter Property="Cursor" Value="IBeam" />
48-
<Setter Property="MinHeight" Value="{DynamicResource TextBoxThemeMinHeight}" />
45+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
4946
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
5047
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
5148
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
@@ -256,7 +253,7 @@
256253
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
257254
<Setter Property="HorizontalContentAlignment" Value="Left" />
258255
<Setter Property="VerticalContentAlignment" Value="Top" />
259-
<Setter Property="MinHeight" Value="{DynamicResource TextBoxThemeMinHeight}" />
256+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
260257
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
261258
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
262259
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Dark.xaml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<!-- Moved to Light, Dark and HC resource files -->
7070
<!-- <Thickness x:Key="TextControlBorderThemeThicknessFocused">2</Thickness> -->
7171
<system:Double x:Key="ContentControlFontSize">14</system:Double>
72-
<system:Double x:Key="TextControlThemeMinHeight">24</system:Double>
72+
<system:Double x:Key="TextControlThemeMinHeight">32</system:Double>
7373
<system:Double x:Key="TextControlThemeMinWidth">0</system:Double>
7474
<system:Double x:Key="TreeViewItemMultiSelectCheckBoxMinHeight">24</system:Double>
7575
<system:Double x:Key="TreeViewItemPresenterMargin">0</system:Double>
@@ -1480,7 +1480,7 @@
14801480
<Setter Property="HorizontalContentAlignment" Value="Left" />
14811481
<Setter Property="VerticalContentAlignment" Value="Top" />
14821482
<Setter Property="Cursor" Value="IBeam" />
1483-
<Setter Property="MinHeight" Value="{DynamicResource TextBoxThemeMinHeight}" />
1483+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
14841484
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
14851485
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
14861486
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
@@ -1793,7 +1793,7 @@
17931793
<Setter Property="HorizontalAlignment" Value="Stretch" />
17941794
<Setter Property="VerticalAlignment" Value="Center" />
17951795
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
1796-
<Setter Property="VerticalContentAlignment" Value="Top" />
1796+
<Setter Property="VerticalContentAlignment" Value="Center" />
17971797
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
17981798
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
17991799
<Setter Property="Padding" Value="{DynamicResource ComboBoxPadding}" />
@@ -2552,6 +2552,7 @@
25522552
<Setter Property="Background" Value="{DynamicResource DatePickerBackground}" />
25532553
<Setter Property="BorderBrush" Value="{DynamicResource TextControlElevationBorderBrush}" />
25542554
<Setter Property="BorderThickness" Value="{StaticResource DatePickerBorderThickness}" />
2555+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
25552556
<Setter Property="HorizontalAlignment" Value="Stretch" />
25562557
<Setter Property="VerticalAlignment" Value="Center" />
25572558
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
@@ -2605,7 +2606,7 @@
26052606
<ColumnDefinition Width="*" />
26062607
<ColumnDefinition Width="Auto" />
26072608
</Grid.ColumnDefinitions>
2608-
<Border x:Name="BorderElement" Grid.ColumnSpan="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding Border.CornerRadius}" MinHeight="32">
2609+
<Border x:Name="BorderElement" Grid.ColumnSpan="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding Border.CornerRadius}" MinHeight="{TemplateBinding MinHeight}">
26092610
</Border>
26102611
<DatePickerTextBox x:Name="PART_TextBox" Padding="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" KeyboardNavigation.TabIndex="0" />
26112612
<Button x:Name="PART_Button" Grid.Column="1" VerticalAlignment="Stretch" Style="{StaticResource CalendarButtonStyle}" KeyboardNavigation.TabIndex="1" MinWidth="30" />
@@ -4137,9 +4138,6 @@
41374138
<!-- These rsources are redefined in .NET 10 -->
41384139
<!-- <Thickness x:Key="PasswordBoxBorderThemeThickness">1,1,1,1</Thickness> -->
41394140
<Thickness x:Key="PasswordBoxBorderThemeThickness">1</Thickness>
4140-
<!-- Instead of PasswordBoxThemeMinHeight, we need to use TextControlThemeMinHeight, but modifying that right now
4141-
will affect the other styles as well. Once the remaining styles using it are fixed, will remove this resource -->
4142-
<sys:Double x:Key="PasswordBoxThemeMinHeight">32</sys:Double>
41434141
<ContextMenu x:Key="DefaultPasswordBoxContextMenu">
41444142
<MenuItem Command="ApplicationCommands.Paste" />
41454143
</ContextMenu>
@@ -4156,7 +4154,7 @@
41564154
<Setter Property="HorizontalContentAlignment" Value="Left" />
41574155
<Setter Property="VerticalContentAlignment" Value="Top" />
41584156
<Setter Property="Cursor" Value="IBeam" />
4159-
<Setter Property="MinHeight" Value="{DynamicResource PasswordBoxThemeMinHeight}" />
4157+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
41604158
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
41614159
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
41624160
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
@@ -4487,9 +4485,6 @@
44874485
<Style BasedOn="{StaticResource DefaultResizeGripStyle}" TargetType="{x:Type ResizeGrip}" />
44884486
<!-- Deprecated RichTextBox Resources ( Used in .NET 9 ) -->
44894487
<Thickness x:Key="RichTextBoxAccentBorderThemeThickness">0,0,0,1</Thickness>
4490-
<!-- Instead of RichTextBoxThemeMinHeight, we need to use TextControlThemeMinHeight, but modifying that right now
4491-
will affect the other styles as well. Once the remaining styles using it are fixed, will remove this resource -->
4492-
<system:Double x:Key="RichTextBoxThemeMinHeight">32</system:Double>
44934488
<Style x:Key="DefaultRichTextBoxStyle" TargetType="{x:Type RichTextBox}">
44944489
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
44954490
<Setter Property="ContextMenu" Value="{DynamicResource DefaultControlContextMenu}" />
@@ -4503,7 +4498,7 @@
45034498
<Setter Property="HorizontalContentAlignment" Value="Left" />
45044499
<Setter Property="VerticalContentAlignment" Value="Top" />
45054500
<Setter Property="Cursor" Value="IBeam" />
4506-
<Setter Property="MinHeight" Value="{DynamicResource RichTextBoxThemeMinHeight}" />
4501+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
45074502
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
45084503
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
45094504
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
@@ -5219,9 +5214,6 @@
52195214
<!-- <Thickness x:Key="TextBoxClearButtonMargin">0,0,4,0</Thickness> -->
52205215
<!-- <Thickness x:Key="TextBoxClearButtonPadding">0,0,0,0</Thickness> -->
52215216
<system:Double x:Key="TextBoxIconFontSize">12</system:Double>
5222-
<!-- Instead of TextBoxThemeMinHeight, we need to use TextControlThemeMinHeight, but modifying that right now
5223-
will affect the other styles as well. Once the remaining styles using it are fixed, will remove this resource -->
5224-
<system:Double x:Key="TextBoxThemeMinHeight">32</system:Double>
52255217
<Thickness x:Key="TextBoxClearButtonMargin">0,4,4,4</Thickness>
52265218
<Thickness x:Key="TextBoxClearButtonPadding">0,0,-2,0</Thickness>
52275219
<Style x:Key="DefaultTextBoxBaseStyle" TargetType="{x:Type TextBoxBase}">
@@ -5237,7 +5229,7 @@
52375229
<Setter Property="HorizontalContentAlignment" Value="Left" />
52385230
<Setter Property="VerticalContentAlignment" Value="Top" />
52395231
<Setter Property="Cursor" Value="IBeam" />
5240-
<Setter Property="MinHeight" Value="{DynamicResource TextBoxThemeMinHeight}" />
5232+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
52415233
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
52425234
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
52435235
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
@@ -5383,7 +5375,7 @@
53835375
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
53845376
<Setter Property="HorizontalContentAlignment" Value="Left" />
53855377
<Setter Property="VerticalContentAlignment" Value="Top" />
5386-
<Setter Property="MinHeight" Value="{DynamicResource TextBoxThemeMinHeight}" />
5378+
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
53875379
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
53885380
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
53895381
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />

0 commit comments

Comments
 (0)