Skip to content

Commit 3e005e0

Browse files
authored
Putting in a sample for working around Dragablz using an old brush name (#2368)
1 parent ed8bbf6 commit 3e005e0

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

MahMaterialDragablzMashUp/App.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<ResourceDictionary Source="pack://application:,,,/ShowMeTheXAML.AvalonEdit;component/Themes/xamldisplayer.xaml" />
3232

3333
</ResourceDictionary.MergedDictionaries>
34+
3435
<!-- MahApps Brushes -->
3536
<!--<SolidColorBrush x:Key="HighlightBrush" Color="{DynamicResource Primary700}"/>
3637
<SolidColorBrush x:Key="AccentColorBrush" Color="{DynamicResource Primary500}"/>

MahMaterialDragablzMashUp/App.xaml.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Windows;
55
using MaterialDesignColors;
66
using ShowMeTheXAML;
7+
using System.Windows.Media;
78

89
namespace MahMaterialDragablzMashUp
910
{
@@ -16,6 +17,19 @@ protected override void OnStartup(StartupEventArgs e)
1617
{
1718
XamlDisplay.Init();
1819
base.OnStartup(e);
20+
21+
//Add/Update brush used by Dragablz when the theme changes
22+
//Solution for https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/issues/2349
23+
PaletteHelper helper = new PaletteHelper();
24+
if (helper.GetThemeManager() is { } themeManager)
25+
{
26+
themeManager.ThemeChanged += ThemeManager_ThemeChanged;
27+
}
28+
}
29+
30+
private void ThemeManager_ThemeChanged(object? sender, ThemeChangedEventArgs e)
31+
{
32+
Resources["SecondaryAccentBrush"] = new SolidColorBrush(e.NewTheme.SecondaryMid.Color);
1933
}
2034
}
2135
}

0 commit comments

Comments
 (0)