2 years ago
#48073
dvdgnz
Weird theming issue with multiple assemblies
I am running into a weird issue with MahApps Themes when different assemblies create windows in succession.
The assemblies are .DLL Add-ins for Autodesk Revit. Since I am the one creating both, I have also made sure they reference the same versions of MahApps (2.4.9) and ControlzEx (4.4.0).
When launched, both add-ins create a MetroWindow with the given theme and the execution ends when that window is closed. This works well when any add-in first launches.
However, if launching a different add-in after the first has been closed, some controls are displayed with missing visuals, or wrong background colors. It seems like something is getting skipped or missing in their resources?
Messed up window after other add-in is launched
I attached a debugger to the main process, and I can see each add-in loading their referenced DLLs from their own folder (assemblies are strong named afaik) with the right version.
I have been trying to solve this issues for the past few days and I have run out of ideas.
I have tried both referencing the MahApps theme in the XAML Window.Resources, and also applying a theme via code-behind after the InitializeComponent(), but the result is always the same.
<mah:MetroWindow x:Class="Odeh.CSI2Revit.Reactions.ImportReactionsWnd"
...other ns...
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:icons="http://metro.mahapps.com/winfx/xaml/iconpacks"
Title="Window Title" Activated="Window_Activated" WindowStartupLocation="CenterScreen" Loaded="MetroWindow_Loaded" >
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<!-- Theme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
<ResourceDictionary>
.... more styles
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
c#
mahapps.metro
revit-api
theming
0 Answers
Your Answer