Skip to content

Commit 5a93b0b

Browse files
authored
Fix for Small discrepancies with Filled-/Outlined styles (#3795)
* fixed Background of ComboBox when disabled * apply Opacity to "ContentGrid" when AutoSuggestBoxOutLined style is used so that the ClearButton get the correct opacity * fixes point 3 and 4 * Removed Triggers to set the Opacity of the SmartHint for OutLined TextFields (AutoSuggestBox) * Because the internal TextBox is the "entire thing" - when it comes to the Background of the control - I moved the Background="{TemplateBinding Background}" to the TextBox * revert demo app to original state
1 parent d597c0a commit 5a93b0b

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.AutoSuggestBox.xaml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@
362362

363363
<!-- Outlined text field -->
364364
<Trigger Property="wpf:TextFieldAssist.HasOutlinedTextField" Value="True">
365-
<Setter TargetName="HintWrapper" Property="Opacity" Value="{Binding Path=(wpf:HintAssist.HintOpacity), RelativeSource={RelativeSource TemplatedParent}}" />
366365
<Setter TargetName="Underline" Property="Visibility" Value="Collapsed" />
367366
<Setter TargetName="Hint" Property="FloatingTarget" Value="{Binding ElementName=OuterBorder}" />
368367
<Setter TargetName="Hint" Property="FloatingAlignment" Value="Center" />
@@ -395,27 +394,19 @@
395394
<Condition Property="IsEnabled" Value="False" />
396395
<Condition Property="wpf:TextFieldAssist.HasFilledTextField" Value="True" />
397396
</MultiTrigger.Conditions>
398-
<Setter TargetName="PART_ClearButton" Property="Opacity" Value="1" />
399-
<Setter TargetName="OuterBorder" Property="Opacity" Value="{x:Static wpf:Constants.TextBoxNotEnabledOpacity}" />
397+
<Setter TargetName="PART_ClearButton" Property="Opacity" Value="{x:Static wpf:Constants.TextBoxNotEnabledOpacity}" />
400398
</MultiTrigger>
401399
<MultiTrigger>
402400
<MultiTrigger.Conditions>
403401
<Condition Property="IsEnabled" Value="False" />
404402
<Condition Property="wpf:TextFieldAssist.HasOutlinedTextField" Value="True" />
405403
</MultiTrigger.Conditions>
406404
<Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.TextBox.OutlineInactiveBorder}" />
407-
<Setter TargetName="HintWrapper" Property="Opacity">
408-
<Setter.Value>
409-
<Binding Converter="{x:Static converters:MathConverter.MultiplyInstance}"
410-
ConverterParameter="{x:Static wpf:Constants.TextBoxNotEnabledOpacity}"
411-
Path="(wpf:HintAssist.HintOpacity)"
412-
RelativeSource="{RelativeSource TemplatedParent}" />
413-
</Setter.Value>
414-
</Setter>
415405
<Setter TargetName="PART_ClearButton" Property="Opacity" Value="{x:Static wpf:Constants.TextBoxNotEnabledOpacity}" />
416406
<Setter TargetName="PART_ContentHost" Property="Opacity" Value="{x:Static wpf:Constants.TextBoxNotEnabledOpacity}" />
417407
<Setter TargetName="PrefixTextBlock" Property="Opacity" Value="{x:Static wpf:Constants.TextBoxNotEnabledOpacity}" />
418408
<Setter TargetName="SuffixTextBlock" Property="Opacity" Value="{x:Static wpf:Constants.TextBoxNotEnabledOpacity}" />
409+
<Setter TargetName="ContentGrid" Property="Opacity" Value="{x:Static wpf:Constants.TextBoxNotEnabledOpacity}" />
419410
</MultiTrigger>
420411

421412
<!-- IsKeyboardFocused -->

src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@
627627
<Condition Property="wpf:TextFieldAssist.HasOutlinedTextField" Value="False" />
628628
</MultiTrigger.Conditions>
629629
<Setter TargetName="OuterBorder" Property="BorderBrush" Value="Transparent" />
630-
<Setter TargetName="OuterBorder" Property="Opacity" Value="{x:Static wpf:Constants.TextBoxNotEnabledOpacity}" />
630+
<Setter TargetName="ContentGrid" Property="Opacity" Value="{x:Static wpf:Constants.TextBoxNotEnabledOpacity}" />
631631
<Setter TargetName="OuterBorder" Property="wpf:BottomDashedLineAdorner.IsAttached" Value="True" />
632632
<Setter TargetName="OuterBorder" Property="wpf:BottomDashedLineAdorner.DashStyle" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:TextFieldAssist.HasFilledTextField), Converter={StaticResource BooleanToDashStyleConverter}}" />
633633
<Setter TargetName="toggleButton" Property="Opacity" Value="1" />

src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml

Lines changed: 3 additions & 2 deletions
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:internal="clr-namespace:MaterialDesignThemes.Wpf.Internal"
@@ -55,9 +55,10 @@
5555
<converters:NonDefaultThicknessConverter x:Key="OutlinedBorderInactiveThicknessConverter" DefaultThickness="{x:Static wpf:Constants.DefaultOutlinedBorderInactiveThickness}" />
5656
<converters:NonDefaultThicknessConverter x:Key="OutlinedBorderActiveThicknessConverter" DefaultThickness="{x:Static wpf:Constants.DefaultOutlinedBorderActiveThickness}" />
5757
</ControlTemplate.Resources>
58-
<Border Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding wpf:TextFieldAssist.TextFieldCornerRadius}">
58+
<Border CornerRadius="{TemplateBinding wpf:TextFieldAssist.TextFieldCornerRadius}">
5959
<Grid>
6060
<TextBox x:Name="PART_TextBox"
61+
Background="{TemplateBinding Background}"
6162
Padding="{TemplateBinding Padding, Converter={StaticResource NumericUpDownPaddingConverter}}"
6263
VerticalAlignment="Stretch"
6364
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"

0 commit comments

Comments
 (0)