Mahapps.metro: MetroWindow shows black backround after update to newest 2.0 alpha

Created on 15 Mar 2020  路  8Comments  路  Source: MahApps/MahApps.Metro

I am using a custom theme based on this example with the 2.0 preview package.

After update from 2.0.0-alpha0660 to 2.0.0-alpha0748 the background of the MetroWindow is black, without changing the styles. How can I fix it to make it work with the latest alpha?

Most helpful comment

@akordowski I have updated the code-samples to the latest MahApps v2.0.0-alpha0748

All 8 comments

Hi @akordowski
If you are using MahApps.Brushes.Black or MahApps.Brushes.White then you need to change them to MahApps.Brushes.ThemeForeground or MahApps.Brushes.ThemeBackground because it is more clear to new users.

If this does not solve your issue it would be good if you can provide a sample App.

Happy coding
Tim

Hi @timunie, thank you for your response. As I said, I use this theme with custom colors. I tried to modify key names, but it has no effect. I think one of these lines have to be changed, but I don't know which.

https://github.com/punker76/code-samples/blob/850e1935767874fd9f72acebbc656c3b192a82f1/MahAppsMetroThemesSample/MahAppsMetroThemesSample/CustomAccents/Light.Accent1.xaml#L60-L66

Is there a reference where I could take a look?

Hi @akordowski
you can grab a fresh Theme from here and modify it to your needs. Replace all Tags in {{XXX}}

another way would be creating a ThemeHelper for dynamic Theme generation. I will update my code soon and send you a link.

That said there will be another breaking change (until May is planned) . You will be able to define custom Themes on Runtime then.

Happy coding
Tim

@akordowski
ok here is a temporary solution: https://github.com/timunie/TimsWpfControls/blob/master/TimsWpfControls/TimsWpfControls/MahAppsHelper/ThemeManagerHelper.cs

I use this in my Apps daily, But I don't know how it will work in your environment. If you have any questions I am also on gitter active.

Happy coding
Tim

Hmm, the new Theme Template doesn't compile. I get errors with the xmlns:markup="clr-namespace:MahApps.Metro.Markup" namespace and the {{xxxx}} definitions. I will revert it back to the old version and wait until the other breaking changes are implemented. Thank you for your help!

I fully understand this. Here is an additional info in case you are interested in: https://github.com/ControlzEx/ControlzEx/issues/102

Have a nice evening

@akordowski I have updated the code-samples to the latest MahApps v2.0.0-alpha0748

Thank you very much @punker76! It works now.

Was this page helpful?
0 / 5 - 0 ratings