Skip to content

Commit c496f4d

Browse files
Adjustments after the SmartHint PRs merged (#3532)
* Fix styles in fields line up demo pages * Fix default value in TimePicker template to align with the others * Fix wrong colors in PasswordBox * Align styles with respect to hint opacity * Fix UI jump in ComboBox style
1 parent 853123c commit c496f4d

13 files changed

+333
-83
lines changed

MainDemo.Wpf/FieldsLineUp.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
<TextBox Grid.Row="1" Grid.Column="1" />
200200
<TextBox Grid.Row="2"
201201
Grid.Column="1"
202-
materialDesign:HintAssist.IsFloating="True" />
202+
Style="{StaticResource MaterialDesignFloatingHintTextBox}" />
203203
<TextBox Grid.Row="3"
204204
Grid.Column="1"
205205
Style="{StaticResource MaterialDesignFilledTextBox}" />
@@ -210,7 +210,7 @@
210210
<PasswordBox Grid.Row="1" Grid.Column="2" />
211211
<PasswordBox Grid.Row="2"
212212
Grid.Column="2"
213-
materialDesign:HintAssist.IsFloating="True" />
213+
Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" />
214214
<PasswordBox Grid.Row="3"
215215
Grid.Column="2"
216216
Style="{StaticResource MaterialDesignFilledPasswordBox}" />
@@ -221,7 +221,7 @@
221221
<ComboBox Grid.Row="1" Grid.Column="3" />
222222
<ComboBox Grid.Row="2"
223223
Grid.Column="3"
224-
materialDesign:HintAssist.IsFloating="true" />
224+
Style="{StaticResource MaterialDesignFloatingHintComboBox}" />
225225
<ComboBox Grid.Row="3"
226226
Grid.Column="3"
227227
Style="{StaticResource MaterialDesignFilledComboBox}" />

MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
<TextBox Grid.Row="1" Grid.Column="1" />
191191
<TextBox Grid.Row="2"
192192
Grid.Column="1"
193-
materialDesign:HintAssist.IsFloating="True" />
193+
Style="{StaticResource MaterialDesignFloatingHintTextBox}" />
194194
<TextBox Grid.Row="3"
195195
Grid.Column="1"
196196
Style="{StaticResource MaterialDesignFilledTextBox}" />
@@ -201,7 +201,7 @@
201201
<PasswordBox Grid.Row="1" Grid.Column="2" />
202202
<PasswordBox Grid.Row="2"
203203
Grid.Column="2"
204-
materialDesign:HintAssist.IsFloating="True" />
204+
Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" />
205205
<PasswordBox Grid.Row="3"
206206
Grid.Column="2"
207207
Style="{StaticResource MaterialDesignFilledPasswordBox}" />
@@ -212,7 +212,7 @@
212212
<ComboBox Grid.Row="1" Grid.Column="3" />
213213
<ComboBox Grid.Row="2"
214214
Grid.Column="3"
215-
materialDesign:HintAssist.IsFloating="true" />
215+
Style="{StaticResource MaterialDesignFloatingHintComboBox}" />
216216
<ComboBox Grid.Row="3"
217217
Grid.Column="3"
218218
Style="{StaticResource MaterialDesignFilledComboBox}" />

MaterialDesignThemes.UITests/WPF/Theme/ThemeTests.g.cs

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ private partial string GetXamlWrapPanel()
7272
<TextBlock Text="TextBox.FilledBackground" Background="{StaticResource MaterialDesign.Brush.TextBox.FilledBackground}" />
7373
<TextBlock Text="TextBox.HoverBackground" Background="{StaticResource MaterialDesign.Brush.TextBox.HoverBackground}" />
7474
<TextBlock Text="TextBox.OutlineInactiveBorder" Background="{StaticResource MaterialDesign.Brush.TextBox.OutlineInactiveBorder}" />
75+
<TextBlock Text="PasswordBox.HoverBorder" Background="{StaticResource MaterialDesign.Brush.PasswordBox.HoverBorder}" />
76+
<TextBlock Text="PasswordBox.Border" Background="{StaticResource MaterialDesign.Brush.PasswordBox.Border}" />
77+
<TextBlock Text="PasswordBox.OutlineBorder" Background="{StaticResource MaterialDesign.Brush.PasswordBox.OutlineBorder}" />
78+
<TextBlock Text="PasswordBox.FilledBackground" Background="{StaticResource MaterialDesign.Brush.PasswordBox.FilledBackground}" />
79+
<TextBlock Text="PasswordBox.HoverBackground" Background="{StaticResource MaterialDesign.Brush.PasswordBox.HoverBackground}" />
80+
<TextBlock Text="PasswordBox.OutlineInactiveBorder" Background="{StaticResource MaterialDesign.Brush.PasswordBox.OutlineInactiveBorder}" />
7581
<TextBlock Text="GridSplitter.Background" Background="{StaticResource MaterialDesign.Brush.GridSplitter.Background}" />
7682
<TextBlock Text="GridSplitter.PreviewBackground" Background="{StaticResource MaterialDesign.Brush.GridSplitter.PreviewBackground}" />
7783
<TextBlock Text="Header.Foreground" Background="{StaticResource MaterialDesign.Brush.Header.Foreground}" />
@@ -142,6 +148,16 @@ private partial string GetXamlWrapPanel()
142148
<TextBlock Text="MaterialDesignTextFieldBoxHoverBackground" Background="{StaticResource MaterialDesignTextFieldBoxHoverBackground}" />
143149
<TextBlock Text="MaterialDesignDivider" Background="{StaticResource MaterialDesignDivider}" />
144150
<TextBlock Text="MaterialDesignTextAreaInactiveBorder" Background="{StaticResource MaterialDesignTextAreaInactiveBorder}" />
151+
<TextBlock Text="MaterialDesignBody" Background="{StaticResource MaterialDesignBody}" />
152+
<TextBlock Text="MaterialDesignBodyLight" Background="{StaticResource MaterialDesignBodyLight}" />
153+
<TextBlock Text="MaterialDesignCheckBoxOff" Background="{StaticResource MaterialDesignCheckBoxOff}" />
154+
<TextBlock Text="MaterialDesignTextBoxBorder" Background="{StaticResource MaterialDesignTextBoxBorder}" />
155+
<TextBlock Text="MaterialDesignColumnHeader" Background="{StaticResource MaterialDesignColumnHeader}" />
156+
<TextBlock Text="MaterialDesignTextAreaBorder" Background="{StaticResource MaterialDesignTextAreaBorder}" />
157+
<TextBlock Text="MaterialDesignTextFieldBoxBackground" Background="{StaticResource MaterialDesignTextFieldBoxBackground}" />
158+
<TextBlock Text="MaterialDesignTextFieldBoxHoverBackground" Background="{StaticResource MaterialDesignTextFieldBoxHoverBackground}" />
159+
<TextBlock Text="MaterialDesignDivider" Background="{StaticResource MaterialDesignDivider}" />
160+
<TextBlock Text="MaterialDesignTextAreaInactiveBorder" Background="{StaticResource MaterialDesignTextAreaInactiveBorder}" />
145161
<TextBlock Text="MaterialDesignColumnHeader" Background="{StaticResource MaterialDesignColumnHeader}" />
146162
<TextBlock Text="MaterialDesignTextAreaBorder" Background="{StaticResource MaterialDesignTextAreaBorder}" />
147163
<TextBlock Text="MaterialDesignToolBarBackground" Background="{StaticResource MaterialDesignToolBarBackground}" />
@@ -422,6 +438,36 @@ private partial async Task AssertAllThemeBrushesSet(IVisualElement<WrapPanel> pa
422438
Color? textBlockBackground = await textBlock.GetBackgroundColor();
423439
Assert.Equal(await GetResourceColor("MaterialDesign.Brush.TextBox.OutlineInactiveBorder"), textBlockBackground);
424440
}
441+
{
442+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"PasswordBox.HoverBorder\"]");
443+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
444+
Assert.Equal(await GetResourceColor("MaterialDesign.Brush.PasswordBox.HoverBorder"), textBlockBackground);
445+
}
446+
{
447+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"PasswordBox.Border\"]");
448+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
449+
Assert.Equal(await GetResourceColor("MaterialDesign.Brush.PasswordBox.Border"), textBlockBackground);
450+
}
451+
{
452+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"PasswordBox.OutlineBorder\"]");
453+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
454+
Assert.Equal(await GetResourceColor("MaterialDesign.Brush.PasswordBox.OutlineBorder"), textBlockBackground);
455+
}
456+
{
457+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"PasswordBox.FilledBackground\"]");
458+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
459+
Assert.Equal(await GetResourceColor("MaterialDesign.Brush.PasswordBox.FilledBackground"), textBlockBackground);
460+
}
461+
{
462+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"PasswordBox.HoverBackground\"]");
463+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
464+
Assert.Equal(await GetResourceColor("MaterialDesign.Brush.PasswordBox.HoverBackground"), textBlockBackground);
465+
}
466+
{
467+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"PasswordBox.OutlineInactiveBorder\"]");
468+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
469+
Assert.Equal(await GetResourceColor("MaterialDesign.Brush.PasswordBox.OutlineInactiveBorder"), textBlockBackground);
470+
}
425471
{
426472
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"GridSplitter.Background\"]");
427473
Color? textBlockBackground = await textBlock.GetBackgroundColor();
@@ -772,6 +818,56 @@ private partial async Task AssertAllThemeBrushesSet(IVisualElement<WrapPanel> pa
772818
Color? textBlockBackground = await textBlock.GetBackgroundColor();
773819
Assert.Equal(await GetResourceColor("MaterialDesignTextAreaInactiveBorder"), textBlockBackground);
774820
}
821+
{
822+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"MaterialDesignBody\"]");
823+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
824+
Assert.Equal(await GetResourceColor("MaterialDesignBody"), textBlockBackground);
825+
}
826+
{
827+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"MaterialDesignBodyLight\"]");
828+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
829+
Assert.Equal(await GetResourceColor("MaterialDesignBodyLight"), textBlockBackground);
830+
}
831+
{
832+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"MaterialDesignCheckBoxOff\"]");
833+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
834+
Assert.Equal(await GetResourceColor("MaterialDesignCheckBoxOff"), textBlockBackground);
835+
}
836+
{
837+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"MaterialDesignTextBoxBorder\"]");
838+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
839+
Assert.Equal(await GetResourceColor("MaterialDesignTextBoxBorder"), textBlockBackground);
840+
}
841+
{
842+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"MaterialDesignColumnHeader\"]");
843+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
844+
Assert.Equal(await GetResourceColor("MaterialDesignColumnHeader"), textBlockBackground);
845+
}
846+
{
847+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"MaterialDesignTextAreaBorder\"]");
848+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
849+
Assert.Equal(await GetResourceColor("MaterialDesignTextAreaBorder"), textBlockBackground);
850+
}
851+
{
852+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"MaterialDesignTextFieldBoxBackground\"]");
853+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
854+
Assert.Equal(await GetResourceColor("MaterialDesignTextFieldBoxBackground"), textBlockBackground);
855+
}
856+
{
857+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"MaterialDesignTextFieldBoxHoverBackground\"]");
858+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
859+
Assert.Equal(await GetResourceColor("MaterialDesignTextFieldBoxHoverBackground"), textBlockBackground);
860+
}
861+
{
862+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"MaterialDesignDivider\"]");
863+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
864+
Assert.Equal(await GetResourceColor("MaterialDesignDivider"), textBlockBackground);
865+
}
866+
{
867+
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"MaterialDesignTextAreaInactiveBorder\"]");
868+
Color? textBlockBackground = await textBlock.GetBackgroundColor();
869+
Assert.Equal(await GetResourceColor("MaterialDesignTextAreaInactiveBorder"), textBlockBackground);
870+
}
775871
{
776872
IVisualElement<TextBlock> textBlock = await panel.GetElement<TextBlock>("[Text=\"MaterialDesignColumnHeader\"]");
777873
Color? textBlockBackground = await textBlock.GetBackgroundColor();
@@ -866,6 +962,12 @@ private static IEnumerable<string> GetBrushResourceNames()
866962
yield return "MaterialDesign.Brush.TextBox.FilledBackground";
867963
yield return "MaterialDesign.Brush.TextBox.HoverBackground";
868964
yield return "MaterialDesign.Brush.TextBox.OutlineInactiveBorder";
965+
yield return "MaterialDesign.Brush.PasswordBox.HoverBorder";
966+
yield return "MaterialDesign.Brush.PasswordBox.Border";
967+
yield return "MaterialDesign.Brush.PasswordBox.OutlineBorder";
968+
yield return "MaterialDesign.Brush.PasswordBox.FilledBackground";
969+
yield return "MaterialDesign.Brush.PasswordBox.HoverBackground";
970+
yield return "MaterialDesign.Brush.PasswordBox.OutlineInactiveBorder";
869971
yield return "MaterialDesign.Brush.GridSplitter.Background";
870972
yield return "MaterialDesign.Brush.GridSplitter.PreviewBackground";
871973
yield return "MaterialDesign.Brush.Header.Foreground";
@@ -939,6 +1041,16 @@ private static IEnumerable<string> GetObsoleteBrushResourceNames()
9391041
yield return "MaterialDesignTextFieldBoxHoverBackground";
9401042
yield return "MaterialDesignDivider";
9411043
yield return "MaterialDesignTextAreaInactiveBorder";
1044+
yield return "MaterialDesignBody";
1045+
yield return "MaterialDesignBodyLight";
1046+
yield return "MaterialDesignCheckBoxOff";
1047+
yield return "MaterialDesignTextBoxBorder";
1048+
yield return "MaterialDesignColumnHeader";
1049+
yield return "MaterialDesignTextAreaBorder";
1050+
yield return "MaterialDesignTextFieldBoxBackground";
1051+
yield return "MaterialDesignTextFieldBoxHoverBackground";
1052+
yield return "MaterialDesignDivider";
1053+
yield return "MaterialDesignTextAreaInactiveBorder";
9421054
yield return "MaterialDesignColumnHeader";
9431055
yield return "MaterialDesignTextAreaBorder";
9441056
yield return "MaterialDesignToolBarBackground";

MaterialDesignThemes.Wpf/ResourceDictionaryExtensions.g.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ private static partial void LoadThemeColors(ResourceDictionary resourceDictionar
6161
theme.TextBoxes.FilledBackground = GetColor(resourceDictionary, "MaterialDesign.Brush.TextBox.FilledBackground", "MaterialDesignTextFieldBoxBackground");
6262
theme.TextBoxes.HoverBackground = GetColor(resourceDictionary, "MaterialDesign.Brush.TextBox.HoverBackground", "MaterialDesignTextFieldBoxHoverBackground", "MaterialDesignDivider");
6363
theme.TextBoxes.OutlineInactiveBorder = GetColor(resourceDictionary, "MaterialDesign.Brush.TextBox.OutlineInactiveBorder", "MaterialDesignTextAreaInactiveBorder");
64+
theme.PasswordBoxes.HoverBorder = GetColor(resourceDictionary, "MaterialDesign.Brush.PasswordBox.HoverBorder", "MaterialDesignBody");
65+
theme.PasswordBoxes.Border = GetColor(resourceDictionary, "MaterialDesign.Brush.PasswordBox.Border", "MaterialDesignBodyLight", "MaterialDesignCheckBoxOff", "MaterialDesignTextBoxBorder");
66+
theme.PasswordBoxes.OutlineBorder = GetColor(resourceDictionary, "MaterialDesign.Brush.PasswordBox.OutlineBorder", "MaterialDesignColumnHeader", "MaterialDesignTextAreaBorder");
67+
theme.PasswordBoxes.FilledBackground = GetColor(resourceDictionary, "MaterialDesign.Brush.PasswordBox.FilledBackground", "MaterialDesignTextFieldBoxBackground");
68+
theme.PasswordBoxes.HoverBackground = GetColor(resourceDictionary, "MaterialDesign.Brush.PasswordBox.HoverBackground", "MaterialDesignTextFieldBoxHoverBackground", "MaterialDesignDivider");
69+
theme.PasswordBoxes.OutlineInactiveBorder = GetColor(resourceDictionary, "MaterialDesign.Brush.PasswordBox.OutlineInactiveBorder", "MaterialDesignTextAreaInactiveBorder");
6470
theme.GridSplitters.Background = GetColor(resourceDictionary, "MaterialDesign.Brush.GridSplitter.Background");
6571
theme.GridSplitters.PreviewBackground = GetColor(resourceDictionary, "MaterialDesign.Brush.GridSplitter.PreviewBackground");
6672
theme.Headers.Foreground = GetColor(resourceDictionary, "MaterialDesign.Brush.Header.Foreground", "MaterialDesignColumnHeader", "MaterialDesignTextAreaBorder");
@@ -186,6 +192,22 @@ private static partial void ApplyThemeColors(ResourceDictionary resourceDictiona
186192
SetSolidColorBrush(resourceDictionary, "MaterialDesignDivider", theme.TextBoxes.HoverBackground);
187193
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.TextBox.OutlineInactiveBorder", theme.TextBoxes.OutlineInactiveBorder);
188194
SetSolidColorBrush(resourceDictionary, "MaterialDesignTextAreaInactiveBorder", theme.TextBoxes.OutlineInactiveBorder);
195+
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.PasswordBox.HoverBorder", theme.PasswordBoxes.HoverBorder);
196+
SetSolidColorBrush(resourceDictionary, "MaterialDesignBody", theme.PasswordBoxes.HoverBorder);
197+
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.PasswordBox.Border", theme.PasswordBoxes.Border);
198+
SetSolidColorBrush(resourceDictionary, "MaterialDesignBodyLight", theme.PasswordBoxes.Border);
199+
SetSolidColorBrush(resourceDictionary, "MaterialDesignCheckBoxOff", theme.PasswordBoxes.Border);
200+
SetSolidColorBrush(resourceDictionary, "MaterialDesignTextBoxBorder", theme.PasswordBoxes.Border);
201+
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.PasswordBox.OutlineBorder", theme.PasswordBoxes.OutlineBorder);
202+
SetSolidColorBrush(resourceDictionary, "MaterialDesignColumnHeader", theme.PasswordBoxes.OutlineBorder);
203+
SetSolidColorBrush(resourceDictionary, "MaterialDesignTextAreaBorder", theme.PasswordBoxes.OutlineBorder);
204+
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.PasswordBox.FilledBackground", theme.PasswordBoxes.FilledBackground);
205+
SetSolidColorBrush(resourceDictionary, "MaterialDesignTextFieldBoxBackground", theme.PasswordBoxes.FilledBackground);
206+
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.PasswordBox.HoverBackground", theme.PasswordBoxes.HoverBackground);
207+
SetSolidColorBrush(resourceDictionary, "MaterialDesignTextFieldBoxHoverBackground", theme.PasswordBoxes.HoverBackground);
208+
SetSolidColorBrush(resourceDictionary, "MaterialDesignDivider", theme.PasswordBoxes.HoverBackground);
209+
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.PasswordBox.OutlineInactiveBorder", theme.PasswordBoxes.OutlineInactiveBorder);
210+
SetSolidColorBrush(resourceDictionary, "MaterialDesignTextAreaInactiveBorder", theme.PasswordBoxes.OutlineInactiveBorder);
189211
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.GridSplitter.Background", theme.GridSplitters.Background);
190212
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.GridSplitter.PreviewBackground", theme.GridSplitters.PreviewBackground);
191213
SetSolidColorBrush(resourceDictionary, "MaterialDesign.Brush.Header.Foreground", theme.Headers.Foreground);

0 commit comments

Comments
 (0)