SetTheme doesn't update the WPF app

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 10 years ago by Philipp Schmid
Version: 13.2.0590
Platform: .NET 4.0
Environment: Windows 8 (64-bit)
Avatar

I am using the latest build (13.2.590.0) and extracted just the RibbonSamples demo code from the larger SampleApplication-CSharp.VS2010 project. Everything builds and runs correctly, except that I cannot change the themes:

1. Using the ribbon buttons has no effect

2. Calling ThemeManager.SetTheme(this, ThemeNames.MetroDark.ToString()) in the constructor of MainRibbon() doesn't have any effect

3. Calling ThemeManager.CurrentTheme = ThemeNames.MetroDark.ToString() in the constructor of MainRibbon() doesn't have any effect

4. Using 2. or 3. followed by a call to ThemeManager.ApplyTheme(this.GetRootContainer(), ThemeName.MetroDark.ToString()) also doesn't show any effects.

 

When I click on the ribbon button on the SDK sample application the theme of the entire app updates correctly.

What am I missing?

Comments (8)

Answer - Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Philipp,

The ThemeManager.SetTheme method is only for testing and you should just use ThemeManager.CurrentTheme instead.

Second the Metro themes are shipped in a separate assembly since they are optional.  You need to reference that assembly and initialize them with a line of code.  Please check out the Themes documentation since it describes what you need to do to use them.


Actipro Software Support

Posted 10 years ago by Philipp Schmid
Avatar

Ok, even when using ThemeNames.OfficeBlack (instead of MetroBlack) and ThemeManager.CurrentTheme (instead of SetTheme) there is no change. Also using the ribbon menu has no effect (which is also using OfficeBlack and CurrentTheme).

 

Is there a place for me to upload a zip file of my current code (extracted from your SDK solution) that demonstrates the problem?

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Philipp,

What I mentioned above also applies to Office themes, which are shipped in a separate optional assembly.  Please read through the Themes documentation as it explains this and tells you what to do.  Specifically, the first part of the "Getting Started" Themes documentation topic is where it does this.

Thank you for the sample.  You are missing the steps mentioned in that topic and that's why the Office and Metro themes are not working for you.


Actipro Software Support

Posted 10 years ago by Philipp Schmid
Avatar

Thanks, adding the assemblies and registering the catalogs did the trick!

Posted 10 years ago by bukekeff - Engineer, PKU
Avatar

Hi Philipp,

Can you tell me how to add the assemblies and register the catalogs ? Thank you very much.

Posted 10 years ago by Max Palmer
Avatar

I am also having an issue with setting themes and the theme not changing in my application. Everything works for the some of the themes (using SetTheme and AreNativeThemesEnabled = true) but not for MetroDark - which is the theme I'm trying to use. I've checked that the assembly is in the output folder, but have run out of ideas. 

I note that the reply above mentions '... registering the catalogs ...'. Do you have to do this for MetroDark? If so, what do you need to do?

Thanks.

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

As mentioned above, you shouldn't be using SetTheme since it is more for testing. You should be using the static ThemeManager.CurrentTheme property instead since it will properly set app-wide themes.

Also please see the "Getting Started" topic in the Themes documentation.  It tells you the requirements for using the Metro and/or Office themes, such as the assemblies used and how to register their theme catalogs.  The app startup code in our Sample Browser also shows examples of how to register the catalogs.


Actipro Software Support

Posted 10 years ago by bukekeff - Engineer, PKU
Avatar

OK. I have resolved the problem according to your suggestion. Thank U very much.

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.