Repository navigation
ControlCatalog: improve transparent appearance - #21441
Conversation
|
You can test this PR using the following package version. |
| private readonly StyleInclude _transparentStyles = new(new Uri($"avares://{typeof(MainView).Assembly.GetName().Name}", UriKind.Absolute)) | ||
| { | ||
| Source = new Uri("/TransparentStyles.axaml", UriKind.Relative) | ||
| }; |
There was a problem hiding this comment.
This StyleInclude can potentially be broken in AOT builds. Compiled XAML class might be trimmed, if it's not referenced statically.
There was a problem hiding this comment.
Typical workarounds are either x:Class or define this StyleInclude in XAML (like here)
There was a problem hiding this comment.
Kinda want to improve this C# style include handling, but I don't have any ideas, other than "root everything". And this API is too complex for source-gen C# interceptors.
There was a problem hiding this comment.
Good point. We have other places in the control catalog that aren't AOT compatible, but that's not a reason to introduce a new one.
x:Class is an appropriate solution.
(I wish we could avoid the useless code-behind here by having XamlX generate the class if it does not exist.)
There was a problem hiding this comment.
I wish we could avoid the useless code-behind here by having XamlX generate the class if it does not exist.
I had a branch before, but for Avalonia.Generator. We already generate C# code there, as well as already read XAML. But, IIRC, end result was annoying in Rider intellisense, need to revisit at some point.
|
You can test this PR using the following package version. |
What does the pull request do?
This PR improves the ControlCatalog sample to be a bit nicer to look at when a transparency level is active.
Example
On Windows, with
TransparencyLevel = AcrylicBlurandExtendClientAreaToDecorationsHint = true:Before:

After:
