Skip to content

Commit ef47b25

Browse files
authored
fix(controls): {Password/Text}Box clear button design (#1520)
* Fix TextBox clear button design * Update PasswordBox.xaml * Update TextBox.xaml * Update PasswordBox.xaml
1 parent 403f8d4 commit ef47b25

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/Wpf.Ui/Controls/PasswordBox/PasswordBox.xaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,17 @@
216216
Appearance="Secondary"
217217
Background="Transparent"
218218
BorderBrush="Transparent"
219+
BorderThickness="0"
219220
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
220221
CommandParameter="clear"
221222
Cursor="Arrow"
222223
Foreground="{DynamicResource TextControlButtonForeground}"
223224
Icon="{StaticResource PasswordBoxClearIcon}"
224-
IsTabStop="False" />
225+
IsTabStop="False"
226+
MouseOverBackground="{DynamicResource SubtleFillColorSecondaryBrush}"
227+
MouseOverBorderBrush="Transparent"
228+
PressedBackground="{DynamicResource SubtleFillColorTertiaryBrush}"
229+
PressedBorderBrush="Transparent" />
225230

226231
<controls:Button
227232
x:Name="RevealButton"
@@ -237,12 +242,17 @@
237242
Appearance="Secondary"
238243
Background="Transparent"
239244
BorderBrush="Transparent"
245+
BorderThickness="0"
240246
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
241247
CommandParameter="reveal"
242248
Cursor="Arrow"
243249
Foreground="{DynamicResource TextControlButtonForeground}"
244250
Icon="{StaticResource PasswordBoxRevealIcon}"
245-
IsTabStop="False" />
251+
IsTabStop="False"
252+
MouseOverBackground="{DynamicResource SubtleFillColorSecondaryBrush}"
253+
MouseOverBorderBrush="Transparent"
254+
PressedBackground="{DynamicResource SubtleFillColorTertiaryBrush}"
255+
PressedBorderBrush="Transparent" />
246256

247257
<ContentPresenter
248258
x:Name="ControlIconRight"
@@ -308,6 +318,7 @@
308318
<Condition Property="IsEnabled" Value="True" />
309319
<Condition Property="IsMouseOver" Value="True" />
310320
<Condition Property="IsFocused" Value="False" />
321+
<Condition SourceName="ClearButton" Property="IsFocused" Value="False" />
311322
</MultiTrigger.Conditions>
312323
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
313324
</MultiTrigger>

src/Wpf.Ui/Controls/TextBox/TextBox.xaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,15 @@
189189
Appearance="Secondary"
190190
Background="Transparent"
191191
BorderBrush="Transparent"
192+
BorderThickness="0"
192193
Command="{Binding Path=TemplateButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"
193194
Cursor="Arrow"
194195
Foreground="{DynamicResource TextControlButtonForeground}"
195-
IsTabStop="False">
196+
IsTabStop="False"
197+
MouseOverBackground="{DynamicResource SubtleFillColorSecondaryBrush}"
198+
MouseOverBorderBrush="Transparent"
199+
PressedBackground="{DynamicResource SubtleFillColorTertiaryBrush}"
200+
PressedBorderBrush="Transparent">
196201
<controls:Button.Icon>
197202
<controls:SymbolIcon FontSize="{TemplateBinding FontSize}" Symbol="Dismiss24" />
198203
</controls:Button.Icon>
@@ -253,6 +258,7 @@
253258
<Condition Property="IsEnabled" Value="True" />
254259
<Condition Property="IsMouseOver" Value="True" />
255260
<Condition Property="IsFocused" Value="False" />
261+
<Condition SourceName="ClearButton" Property="IsFocused" Value="False" />
256262
</MultiTrigger.Conditions>
257263
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
258264
</MultiTrigger>

0 commit comments

Comments
 (0)