0

For the current version of our app we do not support high contrast mode. The support for high contrast (with properly designed UI, etc.) is something that we will be adding to our app in a subsequent release/update.

Is there an easy way to force a UWP app to use the default theme even if the user has put their devices in high contrast mode?

In my app.xaml I've defined the following:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary x:Key="HighContrast">
           copy/pasted styles into here
        </ResourceDictionary>
    </ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>

But copied the content of <ResourceDictionary x:Key="Default"> from C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.10586.0\Generic\themeresources.xaml into the HighContrast theme dictionary of my app thinking that this would force the app to still use the default theme even if device is put into HighContrast mode, but that had no effect.

Anyone knows if there is a way to force the app to use the Default theme?

  • Does requestedtheme property works for you? – GeralexGR Mar 03 '16 at 08:06
  • @Jerrak0s No it will not. As per the [MSDN documentation](https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.application.requestedtheme) "The RequestedTheme property is ignored if the user is running in high contrast mode." – Meisam Seyed Aliroteh Mar 07 '16 at 20:04

1 Answers1

0

Officially, the answer is no. Your method is a hack way.

A UWP app supports high-contrast themes by default. If a user has chosen that they want the system to use a high-contrast theme from system settings or accessibility tools, the framework automatically uses colors and style settings that produce a high-contrast layout and rendering for controls and components in the UI.

For more, see High-contrast themes.

As you know, setting the RequestedTheme can not work in high contrast mode. And you have copied the content of <ResourceDictionary x:Key="Default"> to app.xaml. You said it had no effect. The reason is in the content of Default, some properties use the color like this: Color="{StaticResource SystemChromeBlackHighColor}". This color is based on the theme that the user selected.

When the user selectes the high contrast theme, the system will force all the apps to adapt to the high contrast theme. If your app is the only one which dose not use the high contrast color, your app will be ill-adapted to the other apps.

Jayden
  • 3,276
  • 1
  • 10
  • 14