This project is read-only.

Change theme dynamically

Feb 20, 2014 at 2:10 PM
Edited Feb 20, 2014 at 2:16 PM

Simple question but not sure if the answer will be simple.

I want to change the fluent ribbon themes at runtime. I was trying to change the theme from black to blue.

So i set the initial theme to black. It is applied correctly and fluent ribbon shows with black theme.

Then on click of a button handler(not MVVM but only for testing), i do:
 ResourceDictionary rrd = new ResourceDictionary();
 rrd.Source = new Uri("pack://application:,,,/Fluent;Component/Themes/office2010/blue.xaml");
foreach (ResourceDictionary res in Application.Current.Resources.MergedDictionaries)
                if (res.Source != null)
                    string source = res.Source.ToString();
                    if (source.Contains("pack://application:,,,/Fluent"))
This approach of switching the themes at runtime works with avalon dock but with fluent ribbon, the initial black theme disappears and then no new theme gets applied.

Any help will be greatly appreciated.
Feb 20, 2014 at 3:57 PM
You are also removing the Generic.xaml.
So just replacing:
should do the trick.
Feb 20, 2014 at 4:14 PM
Edited Feb 20, 2014 at 4:26 PM
Hi Batzen,

Tried that but the theme doesn't apply fully. Just the header takes the blue theme, rest goes back to default (whitish) theme.

One small side question: when i use it with Fluent.RibbonWindow, All the non-selected tab are not clearly visible due to the default black font of tab header and the default blackish glass effect title bar. Is there a way to make the non-selected tabs more clearly visible?

Image screenshot click here if you can't see image

Feb 20, 2014 at 8:14 PM
Judging from the screenshot, i guess you are not using the latest source version but the binaries instead?
Can you try grabbing the sources and compiling Fluent yourself to see if it's fixed?

I will release new binaries in early march.