Skip to content

Commit 5f93d2c

Browse files
committed
ComboBox without overlay
1 parent 89387ae commit 5f93d2c

File tree

1 file changed

+14
-58
lines changed

1 file changed

+14
-58
lines changed

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml

Lines changed: 14 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,6 @@
1212
<converters:MathConverter x:Key="MathAddConverter" Operation="Add" />
1313
<converters:BrushRoundConverter x:Key="BrushRoundConverter" />
1414

15-
<Storyboard x:Key="MaterialDesignComboBoxPopupAnimationExpand">
16-
<!--
17-
<ThicknessAnimation AccelerationRatio="0.7"
18-
DecelerationRatio="0.3"
19-
Duration="0:0:0.3"
20-
From="16 0 16 0"
21-
Storyboard.TargetName="shadow"
22-
Storyboard.TargetProperty="Margin"
23-
To="0 0 0 0" />
24-
<DoubleAnimation AccelerationRatio="0.7"
25-
DecelerationRatio="0.3"
26-
Duration="0:0:0.4"
27-
From="0"
28-
Storyboard.TargetName="PopupTemplateRootGrid"
29-
Storyboard.TargetProperty="Opacity"
30-
To="1" />
31-
-->
32-
</Storyboard>
33-
34-
<Storyboard x:Key="MaterialDesignComboBoxPopupAnimationCollapse">
35-
<!--
36-
<DoubleAnimation Duration="0:0:0"
37-
Storyboard.TargetName="PopupTemplateRootGrid"
38-
Storyboard.TargetProperty="Opacity"
39-
To="0" />
40-
<ThicknessAnimation Duration="0:0:0.3"
41-
Storyboard.TargetName="shadow"
42-
Storyboard.TargetProperty="Margin"
43-
To="11 0 11 0" />
44-
-->
45-
</Storyboard>
46-
4715
<Style x:Key="FocusVisual">
4816
<Setter Property="Control.Template">
4917
<Setter.Value>
@@ -334,11 +302,10 @@
334302
<Border x:Name="shadow"
335303
Background="Transparent"
336304
BorderBrush="{DynamicResource MaterialDesignShadowBrush}"
337-
Opacity="0.72"
338305
BorderThickness="1"
339306
CornerRadius="2">
340307
<Border.Effect>
341-
<BlurEffect Radius="3"/>
308+
<BlurEffect Radius="6"/>
342309
</Border.Effect>
343310
</Border>
344311
<Grid Margin="1">
@@ -400,14 +367,6 @@
400367
<Setter TargetName="Underline" Property="Visibility" Value="Hidden"/>
401368
<Setter TargetName="toggleButton" Property="Visibility" Value="Hidden"/>
402369
</MultiTrigger>
403-
<Trigger Property="IsDropDownOpen" Value="True">
404-
<Trigger.EnterActions>
405-
<BeginStoryboard Storyboard="{DynamicResource MaterialDesignComboBoxPopupAnimationExpand}" />
406-
</Trigger.EnterActions>
407-
<Trigger.ExitActions>
408-
<BeginStoryboard Storyboard="{DynamicResource MaterialDesignComboBoxPopupAnimationCollapse}" />
409-
</Trigger.ExitActions>
410-
</Trigger>
411370
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true">
412371
<Setter TargetName="shadow" Property="Margin" Value="0" />
413372
</Trigger>
@@ -532,7 +491,7 @@
532491
UseLayoutRounding="True"
533492
Placement="RelativePoint"
534493
PopupAnimation="Fade"
535-
VerticalOffset="-21">
494+
VerticalOffset="-9">
536495
<Grid MinWidth="{Binding ActualWidth, ElementName=templateRoot, Converter={StaticResource MathAddConverter}, ConverterParameter=32}"
537496
MaxHeight="{TemplateBinding MaxDropDownHeight}"
538497
Margin="6">
@@ -542,11 +501,10 @@
542501
<Border x:Name="shadow"
543502
Background="Transparent"
544503
BorderBrush="{DynamicResource MaterialDesignShadowBrush}"
545-
Opacity="0.72"
546504
BorderThickness="1"
547505
CornerRadius="2">
548506
<Border.Effect>
549-
<BlurEffect Radius="3"/>
507+
<BlurEffect Radius="6" />
550508
</Border.Effect>
551509
</Border>
552510
<Grid Margin="1">
@@ -559,7 +517,7 @@
559517
</Grid.RowDefinitions>
560518
<Rectangle Grid.Row="0"
561519
Fill="{DynamicResource MaterialDesignPaper}"
562-
Height="20"/>
520+
Height="8"/>
563521

564522
<Grid Grid.Row="1">
565523
<Grid.ColumnDefinitions>
@@ -597,10 +555,6 @@
597555
</Grid>
598556
<ControlTemplate.Triggers>
599557
<Trigger Property="wpf:TextFieldAssist.IsNullOrEmpty" Value="False">
600-
<!--
601-
<Setter TargetName="GridContentCloneWrapper" Property="Margin" Value="16 4 16 4" />
602-
<Setter TargetName="PART_Popup" Property="VerticalOffset" Value="-20" />
603-
-->
604558
<Trigger.EnterActions>
605559
<BeginStoryboard x:Name="MoveHintAsideStoryboard_BeginStoryboard" Storyboard="{StaticResource MoveHintAsideStoryboard}" />
606560
</Trigger.EnterActions>
@@ -610,15 +564,18 @@
610564
</Trigger>
611565

612566
<Trigger Property="IsEditable" Value="True">
613-
<!--
614-
<Setter TargetName="GridContentCloneWrapper" Property="Margin" Value="16 4 16 4" />
615-
<Setter TargetName="PART_Popup" Property="VerticalOffset" Value="-20" />
616-
-->
617-
618567
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
619568
<Setter TargetName="Underline" Property="Visibility" Value="Visible" />
620569
<Setter TargetName="contentPresenter" Property="Visibility" Value="Collapsed" />
621570
</Trigger>
571+
<MultiTrigger>
572+
<MultiTrigger.Conditions>
573+
<Condition Property="IsEditable" Value="False"/>
574+
<Condition Property="IsDropDownOpen" Value="True"/>
575+
</MultiTrigger.Conditions>
576+
<Setter TargetName="Underline" Property="Visibility" Value="Hidden"/>
577+
<Setter TargetName="toggleButton" Property="Visibility" Value="Hidden"/>
578+
</MultiTrigger>
622579
<MultiTrigger>
623580
<MultiTrigger.Conditions>
624581
<Condition Property="wpf:TextFieldAssist.IsNullOrEmpty" Value="False" />
@@ -654,7 +611,6 @@
654611
</ControlTemplate>
655612

656613
<Style x:Key="MaterialDesignComboBox" TargetType="{x:Type ComboBox}">
657-
<Setter Property="wpf:ComboBoxAssist.ManagedOverlay" Value="True"/>
658614
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
659615
<Setter Property="Background" Value="Transparent"/>
660616
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignTextBoxBorder}"/>
@@ -664,10 +620,10 @@
664620
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
665621
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
666622
<Setter Property="Padding" Value="0 4 0 4" />
667-
<Setter Property="VerticalContentAlignment" Value="Bottom" />
623+
<Setter Property="VerticalContentAlignment" Value="Center" />
668624
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
669625
<Setter Property="HorizontalAlignment" Value="Left"/>
670-
<Setter Property="VerticalAlignment" Value="Bottom"/>
626+
<Setter Property="VerticalAlignment" Value="Center"/>
671627
<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
672628
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
673629
<Setter Property="UseLayoutRounding" Value="False"/>

0 commit comments

Comments
 (0)