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.
sorry for the confusion ... the sample I added wasn't the application in question. It was a demo from Alex Fidanov. I was wondering why it was working perfectly only with a reference to an assembly and
WITHOUT
Infragistics.Windows.Themes.Lipstick.DataPresenter presenter = new Infragistics.Windows.Themes.Lipstick.DataPresenter();
You can try it and just add e.g. the reference to Lipstick.dll ...
As I wrote above my project doesn't work with
It throws throws the error I mentioned above. Sorry I'm taking so much time ...
rmrop said: sorry for the confusion ... the sample I added wasn't the application in question. It was a demo from Alex Fidanov. I was wondering why it was working perfectly only with a reference to an assembly and WITHOUT
The only reason that would work is because by default the project's properties have the Debug->Enable the Visual Studio hosting process option checked. When that is checked and you run the project in VS with the debugger attached, the vs hosting process loads every assembly that the process references at the start of the application. This won't happen when you run without the debugger (as would happen when you distribute your application) or if you disable this option. As I mentioned, the CLR will only load assemblies that you reference/use so you have to include some reference to a type in the assembly that you want the CLR to load.
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?
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.
Hi Daniel,
I just wanted to know if we're able to answer your questions and you still need help? Just let me know. Thank you.
Sincerely,Duane
Could you provide sample code or a project in which you're receiving this error? We can investigate your issue further with that. Thanks.
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 ...