
I'm putting a WPF interface on a legacy MFC application using the WPF HwndSource object. It works surprisingly well.
I'm having a ThemeManager issue however. The first time my UserControl is displayed, the Theme doesn't seem to fully take effect. If I close and display it a second time, it works perfectly.
Currently, I'm putting the typical ThemeManager BeginUpdate/EndUpdate in my UserControl.Loaded event handler.
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
ThemeManager.BeginUpdate();
try
{
ThemesMetroThemeCatalogRegistrar.Register();
ThemeManager.SetAreNativeThemesEnabled(this, true);
ThemeManager.SetTheme(this, ThemeName.MetroLight.ToString());
}
finally
{
ThemeManager.EndUpdate();
}
}
My theory is, since this is MFC Interop, and I don't explicitly create the WPF Application object, I have to do all the ThemeManager stuff somewhere else.
Thoughts?