amwx / FluentAvalonia

Control library focused on fluent design and bringing more WinUI controls into Avalonia
MIT License
1.05k stars 97 forks source link

Unable to find OverlayLayer from given TopLevel #596

Closed BuLuoPiaoYu closed 1 month ago

BuLuoPiaoYu commented 4 months ago

Describe the bug When I create a MainWindow form and inherit from my custom form class AvaWindow, calling ContentDialog.ShowAsync() within it raises the following exception: "Unable to find OverlayLayer from given TopLevel".

Screenshots image

Desktop/Platform (please complete the following information):

Here is the code Style and Code.zip

salty-flower commented 4 months ago

I got a similar exception on Android when tapping on FAComboBox:

Unable to create IPopupImpl and no overlay layer is found for the target control

Test with many combinations and the last working combination is

Bumping either will bring the exception for me.

Looking at changes made between Avalonia 11.1.0-beta1 and 11.1.0-beta2, I noticed this commit has changed Android TopLevel significantly. Not sure if this is related.

amwx commented 1 month ago

You need to make sure your TopLevel (Window or otherwise) has a Style/ControlTheme that has the VisualLayerManager, which is where all the adorner and overlay pieces come in.