Skip to content

Commit 348a87f

Browse files
committed
Generalized popup templates in combobox
1 parent 68edd3c commit 348a87f

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
</Setter>
2727
</Style>
2828

29+
<system:Double x:Key="PopupContentPresenterExtend">4</system:Double>
30+
<system:Double x:Key="PopupTopBottomMargin">8</system:Double>
31+
<system:Double x:Key="PopupLeftRightMargin">16</system:Double>
2932

3033
<ControlTemplate x:Key="PopupContentUpTemplate" TargetType="ContentControl">
3134
<Grid MinWidth="{Binding ElementName=templateRoot, Path=ActualWidth, Converter={StaticResource MathAddConverter}, ConverterParameter=32}"
@@ -50,14 +53,12 @@
5053
<RowDefinition Height="Auto"/>
5154
</Grid.RowDefinitions>
5255
<Rectangle Grid.Row="0"
53-
Fill="{DynamicResource MaterialDesignPaper}"
54-
Height="8"/>
55-
56+
Fill="{DynamicResource MaterialDesignPaper}"
57+
Height="{StaticResource PopupTopBottomMargin}"/>
5658
<ContentPresenter Grid.Row="1"/>
57-
5859
<Rectangle Grid.Row="2"
59-
Fill="{DynamicResource MaterialDesignPaper}"
60-
Height="4"/>
60+
Fill="{DynamicResource MaterialDesignPaper}"
61+
Height="{StaticResource PopupContentPresenterExtend}"/>
6162

6263
<Grid Grid.Row="3">
6364
<Grid.ColumnDefinitions>
@@ -66,19 +67,19 @@
6667
<ColumnDefinition Width="*"/>
6768
</Grid.ColumnDefinitions>
6869
<Rectangle Grid.Column="0"
69-
Width="16"
70-
Fill="{DynamicResource MaterialDesignPaper}"/>
70+
Width="{StaticResource PopupLeftRightMargin}"
71+
Fill="{DynamicResource MaterialDesignPaper}"/>
7172
<Grid Grid.Column="1"
72-
Width="{Binding ElementName=templateRoot, Path=ActualWidth}"
73-
Height="{Binding ElementName=templateRoot, Path=ActualHeight}"/>
73+
Width="{Binding ElementName=templateRoot, Path=ActualWidth}"
74+
Height="{Binding ElementName=templateRoot, Path=ActualHeight}"/>
7475
<Rectangle Grid.Column="2"
75-
MinWidth="16"
76-
Fill="{DynamicResource MaterialDesignPaper}"/>
76+
MinWidth="{StaticResource PopupLeftRightMargin}"
77+
Fill="{DynamicResource MaterialDesignPaper}"/>
7778
</Grid>
7879

7980
<Rectangle Grid.Row="4"
80-
Height="8"
81-
Fill="{DynamicResource MaterialDesignPaper}" />
81+
Height="{StaticResource PopupTopBottomMargin}"
82+
Fill="{DynamicResource MaterialDesignPaper}" />
8283
</Grid>
8384
</Grid>
8485
</ControlTemplate>
@@ -107,7 +108,7 @@
107108
</Grid.RowDefinitions>
108109
<Rectangle Grid.Row="0"
109110
Fill="{DynamicResource MaterialDesignPaper}"
110-
Height="8"/>
111+
Height="{StaticResource PopupTopBottomMargin}"/>
111112

112113
<Grid Grid.Row="1">
113114
<Grid.ColumnDefinitions>
@@ -116,24 +117,24 @@
116117
<ColumnDefinition Width="*"/>
117118
</Grid.ColumnDefinitions>
118119
<Rectangle Grid.Column="0"
119-
Width="16"
120+
Width="{StaticResource PopupLeftRightMargin}"
120121
Fill="{DynamicResource MaterialDesignPaper}"/>
121122
<Grid Grid.Column="1"
122123
Width="{Binding ElementName=templateRoot, Path=ActualWidth}"
123124
Height="{Binding ElementName=templateRoot, Path=ActualHeight}"/>
124125
<Rectangle Grid.Column="2"
125-
MinWidth="16"
126+
MinWidth="{StaticResource PopupLeftRightMargin}"
126127
Fill="{DynamicResource MaterialDesignPaper}"/>
127128
</Grid>
128129

129130
<Rectangle Grid.Row="2"
130131
Fill="{DynamicResource MaterialDesignPaper}"
131-
Height="4"/>
132+
Height="{StaticResource PopupContentPresenterExtend}"/>
132133

133134
<ContentPresenter Grid.Row="3"/>
134135

135136
<Rectangle Grid.Row="4"
136-
Height="8"
137+
Height="{StaticResource PopupTopBottomMargin}"
137138
Fill="{DynamicResource MaterialDesignPaper}" />
138139
</Grid>
139140
</Grid>
@@ -160,13 +161,13 @@
160161
<RowDefinition Height="Auto"/>
161162
</Grid.RowDefinitions>
162163
<Rectangle Grid.Row="0"
163-
Fill="{DynamicResource MaterialDesignPaper}"
164-
Height="8"/>
164+
Fill="{DynamicResource MaterialDesignPaper}"
165+
Height="{StaticResource PopupTopBottomMargin}"/>
165166

166167
<ContentPresenter Grid.Row="1"/>
167168

168169
<Rectangle Grid.Row="2"
169-
Height="8"
170+
Height="{StaticResource PopupTopBottomMargin}"
170171
Fill="{DynamicResource MaterialDesignPaper}" />
171172
</Grid>
172173
</Grid>

0 commit comments

Comments
 (0)