feat: add :focus-visible pseudoclass to ComboBox.

This commit is contained in:
Zhang Dian 2024-05-15 18:44:43 +08:00
parent 634e792f61
commit 9a738603d0
3 changed files with 13 additions and 2 deletions

View File

@ -179,6 +179,10 @@
<Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorPressedBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorPressedBorderBrush}" />
</Style> </Style>
<Style Selector="^:focus-visible">
<Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorPressedBorderBrush}" />
</Style>
<!-- Disabled State --> <!-- Disabled State -->
<Style Selector="^:disabled"> <Style Selector="^:disabled">
<Setter Property="Background" Value="{DynamicResource ComboBoxSelectorDisabledBackground}" /> <Setter Property="Background" Value="{DynamicResource ComboBoxSelectorDisabledBackground}" />
@ -224,6 +228,9 @@
<Setter Property="Background" Value="{DynamicResource ComboBoxSelectorBorderedPressedBackground}" /> <Setter Property="Background" Value="{DynamicResource ComboBoxSelectorBorderedPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorBorderedPressedBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorBorderedPressedBorderBrush}" />
</Style> </Style>
<Style Selector="^:focus-visible /template/ Border#Background">
<Setter Property="BorderBrush" Value="{DynamicResource ComboBoxSelectorBorderedPointeroverBorderBrush}" />
</Style>
<Style Selector="^:disabled"> <Style Selector="^:disabled">
<Style Selector="^ /template/ Border#Background"> <Style Selector="^ /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource ComboBoxSelectorDisabledBackground}" /> <Setter Property="Background" Value="{DynamicResource ComboBoxSelectorDisabledBackground}" />
@ -305,5 +312,9 @@
<Setter Property="Background" Value="{DynamicResource ComboBoxItemSelectedPointeroverBackground}" /> <Setter Property="Background" Value="{DynamicResource ComboBoxItemSelectedPointeroverBackground}" />
</Style> </Style>
</Style> </Style>
<Style Selector="^:focus-visible /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource ComboBoxItemPointeroverBackground}" />
</Style>
</ControlTheme> </ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@ -5,7 +5,7 @@
<SolidColorBrush x:Key="ComboBoxSelectorDisabledBackground" Opacity="0.04" Color="#E6E8EA" /> <SolidColorBrush x:Key="ComboBoxSelectorDisabledBackground" Opacity="0.04" Color="#E6E8EA" />
<SolidColorBrush x:Key="ComboBoxSelectorBorderBrush" Color="Transparent" /> <SolidColorBrush x:Key="ComboBoxSelectorBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ComboBoxSelectorPointeroverBorderBrush" Color="Transparent" /> <SolidColorBrush x:Key="ComboBoxSelectorPointeroverBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ComboBoxSelectorPressedBorderBrush" Color="#A9D7FF" /> <SolidColorBrush x:Key="ComboBoxSelectorPressedBorderBrush" Color="#54A9FF" />
<SolidColorBrush x:Key="ComboBoxIconDefaultForeground" Opacity="0.6" Color="#F9F9F9" /> <SolidColorBrush x:Key="ComboBoxIconDefaultForeground" Opacity="0.6" Color="#F9F9F9" />
<SolidColorBrush x:Key="ComboBoxIconPointeroverForeground" Color="#F9F9F9" /> <SolidColorBrush x:Key="ComboBoxIconPointeroverForeground" Color="#F9F9F9" />

View File

@ -5,7 +5,7 @@
<SolidColorBrush x:Key="ComboBoxSelectorDisabledBackground" Opacity="0.02" Color="#2E3238" /> <SolidColorBrush x:Key="ComboBoxSelectorDisabledBackground" Opacity="0.02" Color="#2E3238" />
<SolidColorBrush x:Key="ComboBoxSelectorBorderBrush" Color="Transparent" /> <SolidColorBrush x:Key="ComboBoxSelectorBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ComboBoxSelectorPointeroverBorderBrush" Color="Transparent" /> <SolidColorBrush x:Key="ComboBoxSelectorPointeroverBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="ComboBoxSelectorPressedBorderBrush" Color="#004FB3" /> <SolidColorBrush x:Key="ComboBoxSelectorPressedBorderBrush" Color="#0077FA" />
<SolidColorBrush x:Key="ComboBoxIconDefaultForeground" Opacity="0.62" Color="#1C1F23" /> <SolidColorBrush x:Key="ComboBoxIconDefaultForeground" Opacity="0.62" Color="#1C1F23" />
<SolidColorBrush x:Key="ComboBoxIconPointeroverForeground" Color="#1C1F23" /> <SolidColorBrush x:Key="ComboBoxIconPointeroverForeground" Color="#1C1F23" />