ClipToBounds on parent control is not clipping childrens visual while enabled Compositor
See original GitHub issueDescribe the bug
In avaloniaUI you can clip childrens by enabling ClipToBounds
property on parent control, additional supports clipping rounded corner. But there was a problem while I want clip corner in AvaloniaUI 11.0, it completely broken and you could see some unclipped corner on parent visual.
To Reproduce Steps to reproduce the behavior:
- Create a new project with Avalonia package, version
11.0-preview1
- Add a control, might be border, or any control supports
CornerRadius
property and clipping - Add some childrens in parent control (with
Panel
wrapping), and fill them with colors - Enable
ClipToBounds
in parent control, setCornerRadius
16 (or whatever numbers you want, but minimum 4) - Run program, you will see such glitch I described in this issue.
or you can use project from my glitch reproduce repository
Expected behavior Parent control or visual should clip childrens and applying rounded corners clipping with compositor enabled. something like this:
Screenshots
In Material.Avalonia Demo:
In reproduce project:
Desktop (please complete the following information):
- OS: Windows 10 Professional 21H2
- Version: Avalonia
11.0.0-preview-1
Additional context
Actually it can be fixed by disable compositor, but it supposed to work as well while compositor is enabled.
Add above code to AppBuilder
chain and you will disable compositor.
...
.With(new Win32PlatformOptions
{
UseCompositor = false
})
...
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top GitHub Comments
Hi! Use
AndroidPlatformOptions
instead ofWin32PlatformOptions
:Please refer AndroidPlatform.cs#L76 to know which avaloniaUI options have for Android platform
This should be fixed by #9543