Search code examples
xamluwpwin-universal-appuwp-xamlacrylic-material

Detect whether Acrylic Brush is Supported in the device or not


As per Microsoft's Documentation,

Acrylic automatically adapts its appearance for a wide variety of devices and contexts.

In High Contrast mode, users continue to see the familiar background color of their choosing in place of acrylic. In addition, both background acrylic and in-app acrylic appear as a solid color

When the user turns off transparency in Personalization settings
When battery saver mode is activated
When the app runs on low-end hardware

In addition, only background acrylic will replace its transparency and texture with a solid color

When an app window on desktop deactivates
When the UWP app is running on phone, Xbox, HoloLens or tablet mode

I have two queries regarding Acrylic Brush.

1) Is it possible to detect when acrylic brush is disabled for low end devices?

2) Is there any event to subscribe enable/disable acrylic brush by user? Since there's a setting available to toggle acrylic brush in all apps. enter image description here

PS: I am not trying to use fallback color.


Solution

  • The Transparency effect mode can be checked with the help of UISettings.AdvancedEffectsEnabled bool value.

    There's also an event UISettings.AdvancedEffectsEnabledChanged to subscribe for changes in the transparency mode setting.

        UISettings settings = new UISettings();
    
        private bool _IsTransparencyEnabled = settings.AdvancedEffectsEnabled;
    
        settings.AdvancedEffectsEnabledChanged += settings_AdvancedEffectsEnabledChanged;
    
        private void settings_ColorValuesChanged(UISettings sender, object args)
        {
            settings = (UISettings)sender;
            _IsTransparencyEnabled = settings.AdvancedEffectsEnabled;
            //TODOD: Do other necessary actions when transparency has changed.
        }