-
-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Breaking change] Theming changed once more #811
Comments
Hi! |
You will have to change your code as ThemeManger is no longer a static class. So you have to use ThemeManger.Current in 8.0. |
Hi! To do some testing, I updated our application to version 8.0.0 today, but I did not manage to load the theme file. Before (version 7.0.1), Before, I loaded the theme at runtime from a resource file and switched to it: ThemeManager.AddTheme(new Uri("pack://application:,,,/RibbonStuff;component/RibbonTheme.xaml"));
ThemeManager.ChangeTheme(Application.Current, "MyTheme"); In the new Manager the AddTheme overload that takes an Uri is not there anymore. What is the preferred way to accomplish the same? |
That depends on what's in your theme and what you want to modify. Is it a complete theme, or did you use it to add additional things? |
It is supposed to be an complete, independent theme, not containing anything else. |
Then it's quite easy and the following code should be enough: var source = new Uri("pack://application:,,,/RibbonStuff;component/RibbonTheme.xaml");
var newTheme = new Theme(new LibraryTheme(source, null));
ThemeManager.Current.ChangeTheme(Application.Current, newTheme); |
Thank you for the quick response. When using your code snippet, I first got an exception in RuntimeThemeGenerator, line 100. In the ControlzEx source code, I saw that the problem is that the BaseColor is not set and I added the following lines to my RibbonTheme.xaml file: <system:String x:Key="Theme.BaseColorScheme">Light</system:String>
<system:String x:Key="Theme.ColorScheme">Blue</system:String>
<system:String x:Key="Theme.AlternativeColorScheme">Amber</system:String> I had no idea what to put there, so I just picked names from the built-in themes. Then there is no exception anymore and Ribbon resources are added to the resources of my application. However the resources defined in my theme are not used. To test this, I defined the Fluent.Ribbon.Brushes.Button.MouseOver.Background brush with a green color, but the value contained in the resource dictionary is #330078D7. Are the defined values for BaseColorScheme and so on OK? As I don't really have to change the theme at runtime, I just added the ribbon resources to the merged dictionary of my application and it worked for me, but the behavior is still strange. |
At which level do you load the regular ribbon resources? If it's on the window level you have to change the theme there and not on the application level, which i suggested. |
I'm setting the resources only once, on the application level. |
Could you create a small repro then? |
Here's the repo: Just start the application it will show two message boxes containing one sample color. |
Ah, ok. |
ThemeManager
was moved fromFluent.Ribbon
toControlzEx
.This was done to be able to share one common
ThemeManager
betweenFluent.Ribbon
andMahApps.Metro
.This breaking change will be part of version 8.0.
The text was updated successfully, but these errors were encountered: