Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF Application with Add-in UIs doesn't respect DynamicResource

$
0
0

Hi All,

I am working on a WPF application that has Add-In based usercontrols along with a main window. MainWindow's Application domain (Application instance) is different from Add-In provided UIs' Application Domain.

I am working on providing theme support by replacing a full resource dictionary file containing a set of color brushes at Application.Current.Resources.MergedDictionary object. By this I mean that for each theme, I remove any previously loaded resource dictionary and add a new resource dictionary (a theme<x>-resources.xaml file).

What exactly I'm doing while a selected theme is changed is:

At each app domain level, I subscribe to the selected theme value change event and do the following.

Application.Current.Resources.MergedDictionaries.Remove(<previous-theme-resources.xaml> resource dictionary)Application.Current.Resources.MergedDictionaries.Add(<new-theme-resources.xaml> resource dictionary)

Note: Both resource files contain same keys with different values (Color brushes)

Surprisingly, this is refreshing the colors of my controls in the UI of Main Window. But, the application object of  each Add-In UI is not refreshing the colors of my controls. I suspect that this is due to the usage of Add-Ins for generating UIs of my application.

Could you please suggest me something ?

Thanks in advance,

Sai



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>