Native control checkbox color change style

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 8 years ago by David Peterson
Version: 12.2
Avatar

I've recently come across the need to change the checkmark color in a native checkbox control, styled under WPF Studio (2012.2).

I've seen the forum post where someone was referred to the styles that ship with the product. For the checkbox, namely:

"Hello, you have licensed WPF Studio, so you can download the default styles and templates and easily look this sort of thing up. For instance, the XAML for our CheckBox theme is in this file in the Shared library XAML:

\Shared\Themes\Includes\Styles\Native\Button.xaml

You can see all the brushes used within that template there."

After reviewing Button.xaml, I can't seem to identify the exact color I need to override, or am apparently doing it wrong. As a test I overrode all of the following styles (my best guess) in a dictionary that was merged with others in App.xaml, there was no change in the appearance of the checkmark.

<SolidColorBrush presentationOptions:Freeze="True" x:Key="{x:Static themes:AssetResourceKeys.BulletSquareGlyphBackgroundCheckedNormalBrushKey}" Color="Magenta"/>
<SolidColorBrush presentationOptions:Freeze="True" x:Key="{x:Static themes:AssetResourceKeys.BulletSquareGlyphBackgroundCheckedDisabledBrushKey}" Color="Magenta"/>
<SolidColorBrush presentationOptions:Freeze="True" x:Key="{x:Static themes:AssetResourceKeys.BulletSquareGlyphBackgroundCheckedHoverBrushKey}" Color="Magenta"/>
<SolidColorBrush presentationOptions:Freeze="True" x:Key="{x:Static themes:AssetResourceKeys.BulletSquareGlyphBackgroundCheckedPressedBrushKey}" Color="Magenta"/>
<SolidColorBrush presentationOptions:Freeze="True" x:Key="{x:Static themes:AssetResourceKeys.BulletSquareGlyphBorderCheckedNormalBrushKey}" Color="Magenta"/>
<SolidColorBrush presentationOptions:Freeze="True" x:Key="{x:Static themes:AssetResourceKeys.BulletSquareGlyphBorderCheckedDisabledBrushKey}" Color="Magenta"/>

It is my understanding that overriding such colors at the application level should affect all styled controls. I can guarantee that none of the other merged dictionaries are overriding the styles above, either.

FYI, I'm doing an explicit theme activation at the start of the program in App.xaml.cs, which looks like this:

ThemeManager.BeginUpdate();
try
{
  ThemesOfficeThemeCatalogRegistrar.Register();
  ThemesMetroThemeCatalogRegistrar.Register();
  ThemeManager.AreNativeThemesEnabled = true;
  if ((Environment.OSVersion.Version.Major > 6) || ((Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor >= 2)))
    ThemeManager.CurrentTheme = ThemeName.MetroLight.ToString();
  else
    ThemeManager.CurrentTheme = ThemeName.MetroWhite.ToString();
}
finally
{
  ThemeManager.EndUpdate();
}

Thank you in advance for any help you might provide!

Comments (1)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi David,

When I paste those lines in our Sample Browser's App.xaml file (with appropriate xmlns entries) I see the magenta checks show up in checkboxes, like in the PropertyGrid / Property Editors demo.  Do you see the same for a checked checkbox?  Note I am testing in the 2016.1 version.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.