native control background not updated

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 3 months ago by John Bell
Version: 23.1.4
Avatar

Hi,

The backgound color for native controls like StackPanel, TabControl, Menu, etc. do not change when going to the Dark theme. How do get this to work? I am using the following initialization code:

ImageProvider.Default.ChromaticAdaptationMode = ImageChromaticAdaptationMode.DarkThemes;
ImageProvider.Default.UseMonochromeInHighContrast = true;

ThemeManager.BeginUpdate();
try
{
	ThemeManager.AreNativeThemesEnabled = true;

	ThemeManager.CurrentTheme = ThemeNames.MetroDark;
}
finally
{
	ThemeManager.EndUpdate();
}

Thanks.

Comments (2)

Posted 3 months ago by John Bell
Avatar

Actually, I realized most of this was my fault. The old code was overriding the background colors. Although I still need to force the Background to one of the ContainerBackgroundxxxBrushKey values in some cases.

Posted 3 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi John,

It looks like everything is set up in the code you posted to work properly for theming native controls like TabControl and Menu.  Note that StackPanel is a Panel that is not themed.

It looks like you might have already worked out the issue.  But if you still see problems, perhaps you could try making a new simple sample project and see if it works there.  If it's not working there, you could email our support address the project and we can have a look.  Be sure to exclude the bin/obj folders from the .zip you send so it doesn't get spam blocked, and mention this thread in your message. 

That process might help you discover when something else is conflicting, such as a Style or resource override that blocks ours from taking effect.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.