After following this post: How to use Acrylic Accent in Windows 10 Creators Update?
I've successfully added acrylic to my app on the Creators Update. Unfortunately, when transparency is disabled in the color settings in Windows, my app's background is either a very dark gray in the Light Theme or almost completely pitch black in dark Theme despite the fact that I set the background of my grid that's above the relative panel that makes the window transparent to: Background="{ThemeResource CommandBarBackground}".
Does anyone know how to implement the fallback color in the creators update so that when transparency is disabled, the background switches to the original background color that was set.
Does anyone know how to implement the fallback color in the creators update so that when transparency is disabled, the background switches to the original background color that was set.
There is an AdvancedEffectsEnabled property in UISettings Class which indicates whether the system Transparency effects setting is enabled. When it returns false
, you can reset the background to the original background color.
And there is also an AdvancedEffectsEnabledChanged event occurs when the system advanced UI effects setting is enabled or disabled. You can combine this event with AdvancedEffectsEnabled
property and use them like the following:
UISettings uiSettings = new UISettings();
uiSettings.AdvancedEffectsEnabledChanged += UiSettings_AdvancedEffectsEnabledChangedAsync;
private async void UiSettings_AdvancedEffectsEnabledChangedAsync(UISettings sender, object args)
{
if (sender.AdvancedEffectsEnabled)
{
await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
//TODO: Apply Acrylic Accent
});
}
else
{
await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
//TODO: Reset Background
});
}
}
Please note, AdvancedEffectsEnabledChanged event may not raised in UI thread. To change the background color, we will need CoreDispatcher.RunAsync method.