Skip to content

Commit c0c6d5a

Browse files
authored
Fix #1728. Move CornerRadius Element. (#1736)
1 parent 0ecdc76 commit c0c6d5a

File tree

1 file changed

+49
-69
lines changed

1 file changed

+49
-69
lines changed

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml

Lines changed: 49 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -54,46 +54,37 @@
5454
<BlurEffect Radius="6"/>
5555
</Border.Effect>
5656
</Border>
57-
<Grid Margin="1">
58-
<Grid.RowDefinitions>
59-
<RowDefinition Height="Auto"/>
60-
<RowDefinition Height="*"/>
61-
<RowDefinition Height="Auto"/>
62-
<RowDefinition Height="Auto"/>
63-
<RowDefinition Height="Auto"/>
64-
</Grid.RowDefinitions>
65-
<Border Grid.Row="0"
66-
CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource AncestorType=wpf:ComboBoxPopup}}"
67-
Background="{Binding ElementName=PART_Popup, Path=Background}"
68-
Height="{StaticResource PopupTopBottomMargin}"/>
69-
<ContentPresenter Grid.Row="1"/>
70-
<Border Grid.Row="2"
71-
Background="{Binding ElementName=PART_Popup, Path=Background}"
72-
Height="{StaticResource PopupContentPresenterExtend}"/>
57+
<Border Margin="1"
58+
CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource AncestorType=wpf:ComboBoxPopup}}"
59+
Background="{Binding ElementName=PART_Popup, Path=Background}">
60+
<Grid SnapsToDevicePixels="True">
61+
<Grid.RowDefinitions>
62+
<RowDefinition Height="Auto"/>
63+
<RowDefinition Height="*"/>
64+
<RowDefinition Height="Auto"/>
65+
<RowDefinition Height="Auto"/>
66+
<RowDefinition Height="Auto"/>
67+
</Grid.RowDefinitions>
68+
<Border Grid.Row="0" Height="{StaticResource PopupTopBottomMargin}"/>
69+
<ContentPresenter Grid.Row="1"/>
70+
<Border Grid.Row="2" Height="{StaticResource PopupContentPresenterExtend}"/>
7371

74-
<Grid Grid.Row="3">
75-
<Grid.ColumnDefinitions>
76-
<ColumnDefinition Width="Auto"/>
77-
<ColumnDefinition Width="Auto"/>
78-
<ColumnDefinition Width="*"/>
79-
</Grid.ColumnDefinitions>
80-
<Border Grid.Column="0"
81-
Width="{StaticResource PopupLeftRightMargin}"
82-
Background="{Binding ElementName=PART_Popup, Path=Background}"/>
83-
<Grid Grid.Column="1"
84-
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type wpf:ComboBoxPopup}}, Path=VisiblePlacementWidth}"
85-
Height="{Binding ElementName=templateRoot, Path=ActualHeight}"/>
86-
<Border Grid.Column="2"
87-
MinWidth="{StaticResource PopupLeftRightMargin}"
88-
Background="{Binding ElementName=PART_Popup, Path=Background}"/>
89-
</Grid>
90-
91-
<Border Grid.Row="4"
92-
CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource AncestorType=wpf:ComboBoxPopup}}"
93-
Height="{StaticResource PopupTopBottomMargin}"
94-
Background="{Binding ElementName=PART_Popup, Path=Background}" />
72+
<Grid Grid.Row="3">
73+
<Grid.ColumnDefinitions>
74+
<ColumnDefinition Width="Auto"/>
75+
<ColumnDefinition Width="Auto"/>
76+
<ColumnDefinition Width="*"/>
77+
</Grid.ColumnDefinitions>
78+
<Border Grid.Column="0" Width="{StaticResource PopupLeftRightMargin}"/>
79+
<Grid Grid.Column="1"
80+
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type wpf:ComboBoxPopup}}, Path=VisiblePlacementWidth}"
81+
Height="{Binding ElementName=templateRoot, Path=ActualHeight}"/>
82+
<Border Grid.Column="2" MinWidth="{StaticResource PopupLeftRightMargin}"/>
83+
</Grid>
84+
<Border Grid.Row="4" Height="{StaticResource PopupTopBottomMargin}"/>
9585
</Grid>
96-
</Grid>
86+
</Border>
87+
</Grid>
9788
</ControlTemplate>
9889

9990
<ControlTemplate x:Key="PopupContentDownTemplate" TargetType="ContentControl">
@@ -110,8 +101,10 @@
110101
<BlurEffect Radius="6"/>
111102
</Border.Effect>
112103
</Border>
113-
<Grid Margin="1"
114-
SnapsToDevicePixels="True">
104+
<Border Margin="1"
105+
CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource AncestorType=wpf:ComboBoxPopup}}"
106+
Background="{Binding ElementName=PART_Popup, Path=Background}">
107+
<Grid SnapsToDevicePixels="True">
115108
<Grid.RowDefinitions>
116109
<RowDefinition Height="Auto"/>
117110
<RowDefinition Height="Auto"/>
@@ -120,41 +113,32 @@
120113
<RowDefinition Height="Auto"/>
121114
</Grid.RowDefinitions>
122115
<Border Grid.Row="0"
123-
CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource AncestorType=wpf:ComboBoxPopup}}"
124-
Background="{Binding ElementName=PART_Popup, Path=Background}"
125116
Height="{StaticResource PopupTopBottomMargin}"/>
126-
127117
<Grid Grid.Row="1">
128118
<Grid.ColumnDefinitions>
129119
<ColumnDefinition Width="Auto"/>
130120
<ColumnDefinition Width="Auto"/>
131121
<ColumnDefinition Width="*"/>
132122
</Grid.ColumnDefinitions>
133123
<Border Grid.Column="0"
134-
Width="{StaticResource PopupLeftRightMargin}"
135-
Background="{Binding ElementName=PART_Popup, Path=Background}"
136-
/>
124+
Width="{StaticResource PopupLeftRightMargin}"/>
137125
<Grid Grid.Column="1"
138126
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type wpf:ComboBoxPopup}}, Path=VisiblePlacementWidth}"
139127
Height="{Binding ElementName=templateRoot, Path=ActualHeight}"/>
140128
<Border Grid.Column="2"
141-
MinWidth="{StaticResource PopupLeftRightMargin}"
142-
Background="{Binding ElementName=PART_Popup, Path=Background}"
143-
/>
129+
MinWidth="{StaticResource PopupLeftRightMargin}"/>
144130
</Grid>
145131

146132
<Border Grid.Row="2"
147-
Background="{Binding ElementName=PART_Popup, Path=Background}"
148133
Height="{StaticResource PopupContentPresenterExtend}"/>
149134

150135
<ContentPresenter Grid.Row="3"/>
151136

152137
<Border Grid.Row="4"
153-
CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource AncestorType=wpf:ComboBoxPopup}}"
154-
Height="{StaticResource PopupTopBottomMargin}"
155-
Background="{Binding ElementName=PART_Popup, Path=Background}" />
156-
</Grid>
157-
</Grid>
138+
Height="{StaticResource PopupTopBottomMargin}" />
139+
</Grid>
140+
</Border>
141+
</Grid>
158142
</ControlTemplate>
159143

160144
<ControlTemplate x:Key="PopupContentClassicTemplate" TargetType="ContentControl">
@@ -170,27 +154,23 @@
170154
<Border.Effect>
171155
<BlurEffect Radius="6"/>
172156
</Border.Effect>
173-
</Border>
174-
<Grid Margin="1">
157+
</Border>
158+
<Border Margin="1"
159+
CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource AncestorType=wpf:ComboBoxPopup}}"
160+
Background="{Binding ElementName=PART_Popup, Path=Background}">
161+
<Grid SnapsToDevicePixels="True">
175162
<Grid.RowDefinitions>
176163
<RowDefinition Height="Auto"/>
177164
<RowDefinition Height="*"/>
178165
<RowDefinition Height="Auto"/>
179166
</Grid.RowDefinitions>
180-
<Border Grid.Row="0"
181-
CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource AncestorType=wpf:ComboBoxPopup}}"
182-
Background="{Binding ElementName=PART_Popup, Path=Background}"
183-
Height="{StaticResource PopupTopBottomMargin}"/>
184-
167+
<Border Grid.Row="0" Height="{StaticResource PopupTopBottomMargin}"/>
185168
<ContentPresenter Grid.Row="1"/>
186-
187-
<Border Grid.Row="2"
188-
CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource AncestorType=wpf:ComboBoxPopup}}"
189-
Height="{StaticResource PopupTopBottomMargin}"
190-
Background="{Binding ElementName=PART_Popup, Path=Background}" />
169+
<Border Grid.Row="2" Height="{StaticResource PopupTopBottomMargin}" />
191170
</Grid>
192-
</Grid>
193-
</ControlTemplate>
171+
</Border>
172+
</Grid>
173+
</ControlTemplate>
194174

195175
<Style x:Key="MaterialDesignComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
196176
<Setter Property="OverridesDefaultStyle" Value="True" />

0 commit comments

Comments
 (0)