Hello...
I would like to change the theme of an application at runtime.
In order to achieve this effect I use the ThemeManager "CurrentTheme" Property .
( Already shown in another Thread.)
How may I now access custom Themes or themes which are not predefined in ThemeManager.GetThemes. In example "Lipstick" or "Leaf" ...
I'm a WPF newbee ... Any help is highly welcome.
Thanks,
Daniel
Hello,
In order to set a theme runtime of the existing ones. You just need add the assembly of that theme to your project and use the appropriate style for the component you need. For example you can load the theme for DataPresenter in the constructor or in the loaded event: eInfragistics.Windows.Themes.Lipstick.DataPresenter presenter = new Infragistics.Windows.Themes.Lipstick.DataPresenter();
And simply set current theme in any action for example button click:ThemeManager.CurrentTheme = "Lipstick";
I hope this helps.
Sincerely,DimiDeveloper Support EngineerInfragistics, Inc.
Hello Dimi,
thanks for the quick answer!
Dimi Gineva"] You just need add the assembly of that theme to your project and use the appropriate style for the component you need.
Adding the assembly to my existing project does not seem to work. I still can't use the theme or set the style for a Ribbon Control.
ThemeManager.SetTheme(Ribbon,"Lipstick") doesn't work.
Also the theme isn't part of ThemeManager.GetThemes() ... ThemeManager.CurrentTheme = "Lipstick" leads to "Theme has not been registered".
In the short demo I found in this forum after referencing the assemby everything works just fine ... I'm quite confused at the moment.
Hi Daniel,
Could you provide sample code or a project in which you're receiving this error? We can investigate your issue further with that. Thanks.
Sincerely,Duane
Hello Duane,
I'm still searching my application for the reason of the above mentioned error message:
By accessing the style property for Element "Infragistics.Windows.DataPresenter.XAMDataGrid" a circular reference was found.
Couln't find an answer so far ...
I just wanted to know if we're able to answer your questions and you still need help? Just let me know. Thank you.
Maybe you have a Style where you are trying to set the Theme property? You should not set the Theme property via a Style setter, etc.
Thanks a lot for your answers,
you were right ... the "hosting process option" in my project was unchecked. After referencing a type in an theme assembly these assemblies were loaded as I could see in ThemeManger.GetThemes().
Unfortunately using e.g. ThemeManager.Current ="Fall" got me a Runtime Exception:
"By accessing the style property for Element "Infragistics.Windows.DataPresenter.XAMDataGrid" a cyclic reference was found."
Searching now through my resources to solve the problem ...Perhaps you've got a suggestion?