Skip to content

A Swiss Army knife for developers.

Fixed a bug with dark theme (#51)

Etienne Baudoux0d43cd76c38b
diff --git a/src/dev/impl/DevToys/UI/Controls/ExpandableSettingControl.xaml b/src/dev/impl/DevToys/UI/Controls/ExpandableSettingControl.xaml
index 332d55deb..e5b61858a 100644
--- a/src/dev/impl/DevToys/UI/Controls/ExpandableSettingControl.xaml
+++ b/src/dev/impl/DevToys/UI/Controls/ExpandableSettingControl.xaml
@@ -37,7 +37,6 @@
VerticalAlignment="Stretch"
VerticalContentAlignment="Stretch"
Padding="0"
- Background="{x:Bind ContentBackground, Mode=OneWay}"
CornerRadius="{x:Bind CornerRadius}"
IsExpanded="{x:Bind IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<muxc:Expander.Header>
@@ -60,7 +59,7 @@
x:Name="NonExpanderGrid"
x:Load="{x:Bind ExpandableContent, Mode=OneWay, Converter={StaticResource NullToTrueConverter}}"
Style="{StaticResource GridSettingBlockStyle}"
- Background="{x:Bind HeaderBackground, Mode=OneWay}"
+ Background="{ThemeResource ExpanderHeaderBackground}"
CornerRadius="{x:Bind CornerRadius}">
<local:ExpandableSettingHeaderControl
Title="{x:Bind Title, Mode=OneWay}"
diff --git a/src/dev/impl/DevToys/UI/Controls/ExpandableSettingControl.xaml.cs b/src/dev/impl/DevToys/UI/Controls/ExpandableSettingControl.xaml.cs
index 4e6053d1d..5f941dc69 100644
--- a/src/dev/impl/DevToys/UI/Controls/ExpandableSettingControl.xaml.cs
+++ b/src/dev/impl/DevToys/UI/Controls/ExpandableSettingControl.xaml.cs
@@ -83,73 +83,9 @@ namespace DevToys.UI.Controls
set => SetValue(IsExpandedProperty, value);
}
- public static readonly DependencyProperty ContentBackgroundProperty
- = DependencyProperty.Register(
- nameof(ContentBackground),
- typeof(Brush),
- typeof(ExpandableSettingControl),
- new PropertyMetadata(null, (d, e) =>
- {
- var ctrl = (ExpandableSettingControl)d;
- if (!ctrl._isAppThemeChanging)
- {
- ctrl._isDefaultContentBackgroundValue = false;
- }
- }));
-
- public Brush ContentBackground
- {
- get => (Brush)GetValue(ContentBackgroundProperty);
- set => SetValue(ContentBackgroundProperty, value);
- }
-
- public static readonly DependencyProperty HeaderBackgroundProperty
- = DependencyProperty.Register(
- nameof(HeaderBackground),
- typeof(Brush),
- typeof(ExpandableSettingControl),
- new PropertyMetadata(null, (d, e) =>
- {
- var ctrl = (ExpandableSettingControl)d;
- if (!ctrl._isAppThemeChanging)
- {
- ctrl._isDefaultHeaderBackgroundValue = false;
- }
- }));
-
- public Brush HeaderBackground
- {
- get => (Brush)GetValue(HeaderBackgroundProperty);
- set => SetValue(HeaderBackgroundProperty, value);
- }
-
public ExpandableSettingControl()
{
InitializeComponent();
-
- MefComposer.Provider.Import<IThemeListener>().ThemeChanged += ExpandableSettingControl_ThemeChanged;
-
- _isAppThemeChanging = true;
- ContentBackground = (Brush)Application.Current.Resources["ExpanderContentBackground"];
- HeaderBackground = (Brush)Application.Current.Resources["ExpanderHeaderBackground"];
- _isAppThemeChanging = false;
- }
-
- private void ExpandableSettingControl_ThemeChanged(object sender, System.EventArgs e)
- {
- _isAppThemeChanging = true;
-
- if (_isDefaultContentBackgroundValue)
- {
- ContentBackground = (Brush)Application.Current.Resources["ExpanderContentBackground"];
- }
-
- if (_isDefaultHeaderBackgroundValue)
- {
- HeaderBackground = (Brush)Application.Current.Resources["ExpanderHeaderBackground"];
- }
-
- _isAppThemeChanging = false;
}
}
}
diff --git a/src/dev/impl/DevToys/UI/Controls/ExpandableSettingHeaderControl.xaml b/src/dev/impl/DevToys/UI/Controls/ExpandableSettingHeaderControl.xaml
index 68d2a7302..26372a120 100644
--- a/src/dev/impl/DevToys/UI/Controls/ExpandableSettingHeaderControl.xaml
+++ b/src/dev/impl/DevToys/UI/Controls/ExpandableSettingHeaderControl.xaml
@@ -1,9 +1,8 @@
<UserControl
x:Class="DevToys.UI.Controls.ExpandableSettingHeaderControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="using:DevToys.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converters="using:DevToys.UI.Converters"
mc:Ignorable="d"
diff --git a/src/dev/impl/DevToys/Views/Tools/RegEx/RegExToolPage.xaml b/src/dev/impl/DevToys/Views/Tools/RegEx/RegExToolPage.xaml
index 65b59ed09..b66d2512c 100644
--- a/src/dev/impl/DevToys/Views/Tools/RegEx/RegExToolPage.xaml
+++ b/src/dev/impl/DevToys/Views/Tools/RegEx/RegExToolPage.xaml
@@ -28,8 +28,7 @@
<TextBlock Style="{StaticResource SubTitleTextBlock}" Text="{x:Bind ViewModel.Strings.Configuration}" />
<controls:ExpandableSettingControl
- Title="{x:Bind ViewModel.Strings.Options}"
- ContentBackground="Transparent">
+ Title="{x:Bind ViewModel.Strings.Options}">
<controls:ExpandableSettingControl.Icon>
<FontIcon Glyph="&#xF6A9;" />
</controls:ExpandableSettingControl.Icon>