[Settings]Fix IsEnabledTextBlock secondary style (#27928)

This commit is contained in:
Jaime Bernardo
2023-08-11 08:54:31 +01:00
committed by GitHub
parent aedac403b4
commit 24dfec624e
3 changed files with 5 additions and 4 deletions

View File

@@ -11,7 +11,6 @@
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" /> <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<ResourceDictionary Source="/SettingsXAML/Controls/KeyVisual/KeyVisual.xaml" /> <ResourceDictionary Source="/SettingsXAML/Controls/KeyVisual/KeyVisual.xaml" />
<ResourceDictionary Source="/SettingsXAML/Controls/IsEnabledTextBlock/IsEnabledTextBlock.xaml" />
<ResourceDictionary Source="/SettingsXAML/Styles/TextBlock.xaml" /> <ResourceDictionary Source="/SettingsXAML/Styles/TextBlock.xaml" />
<ResourceDictionary Source="/SettingsXAML/Styles/Button.xaml" /> <ResourceDictionary Source="/SettingsXAML/Styles/Button.xaml" />
<ResourceDictionary Source="/SettingsXAML/Themes/Colors.xaml" /> <ResourceDictionary Source="/SettingsXAML/Themes/Colors.xaml" />

View File

@@ -14,7 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
{ {
public IsEnabledTextBlock() public IsEnabledTextBlock()
{ {
this.DefaultStyleKey = typeof(IsEnabledTextBlock); this.Style = (Style)App.Current.Resources["DefaultIsEnabledTextBlockStyle"];
} }
protected override void OnApplyTemplate() protected override void OnApplyTemplate()

View File

@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"> xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls">
<Style TargetType="local:IsEnabledTextBlock"> <Style x:Key="DefaultIsEnabledTextBlockStyle" TargetType="local:IsEnabledTextBlock">
<Setter Property="Foreground" Value="{ThemeResource DefaultTextForegroundThemeBrush}" /> <Setter Property="Foreground" Value="{ThemeResource DefaultTextForegroundThemeBrush}" />
<Setter Property="IsTabStop" Value="False" /> <Setter Property="IsTabStop" Value="False" />
<Setter Property="Template"> <Setter Property="Template">
@@ -35,7 +35,9 @@
</Style> </Style>
<Style <Style
x:Key="SecondaryIsEnabledTextBlockStyle" x:Key="SecondaryIsEnabledTextBlockStyle"
TargetType="local:IsEnabledTextBlock"> TargetType="local:IsEnabledTextBlock"
BasedOn="{StaticResource DefaultIsEnabledTextBlockStyle}"
>
<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" /> <Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />
<Setter Property="FontSize" Value="{StaticResource SecondaryTextFontSize}" /> <Setter Property="FontSize" Value="{StaticResource SecondaryTextFontSize}" />
</Style> </Style>