AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.04k stars 2.25k forks source link

ExperimentalAcrylicBorder's Material seem to ignore FallbackColor #5440

Closed unconverged closed 3 years ago

unconverged commented 3 years ago

Hi! I'm trying to experiment with ExperimentalAcrylicBorder (no pun intended). I have noticed that it seems to ignore the FallbackColor property.

Consider the following code.

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="acryl.MainWindow"
        TransparencyLevelHint="AcrylicBlur"
        Title="acryl">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="300" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <ExperimentalAcrylicBorder >
            <ExperimentalAcrylicBorder.Material>
              <ExperimentalAcrylicMaterial
                FallbackColor="White"
                TintColor="Black"
                TintOpacity="0.6"
                MaterialOpacity="0.6"
                BackgroundSource="Digger" />
            </ExperimentalAcrylicBorder.Material>
            <StackPanel />
        </ExperimentalAcrylicBorder>
    </Grid>
</Window>

This code produces the following window:

image

I put Mac's Terminal window below to indicate that we can see what's behind the window. Once I make the window inactive (i.e. by selecting another app) the Acrylic border goes gray.

image

According to my experiments, the colour of the area is determined by the TintColor, TintOpacity, and MaterialOpacity properties. The FallbackColor seems to be ignored. Is there a way I can redefine the colour used when the window is inactive? According to this MS docs, "fallback color also replaces acrylic when your app isn’t in the active desktop window". Maybe Avalonia can adopt the same behaviour?

I'm using macOS 10.2 and Avalonia 0.10.0.

pr8x commented 3 years ago

I think you mean macOS 11.2 "Big Sur"?

danwalmsley commented 3 years ago

@IvaYan in Avalonia fallback colour here is only what you get when you try to use Acrylic on an unsupported system. It doesnt get used when inactive.

This is as designed and behavior wont change until we have integrated our composition engine which is in progress.

The conditions for fallback colour are as follows:

unconverged commented 3 years ago

@danwalmsley Ok, I see. Is there an issue about the "composition engine" so I can monitor the progress and check the behaviour again?

@pr8x Exactly, that was just a typo.

julian-baumann commented 2 months ago

Any updates?