AvaloniaUtils / DialogHost.Avalonia

AvaloniaUI control that provides a simple way to display a dialog with information or prompt the user when information is needed
MIT License
256 stars 16 forks source link

How can I open a modal dialog? #67

Open aboimpinto opened 3 weeks ago

aboimpinto commented 3 weeks ago

Hello,

I noticed that when I open the Dialog, it's not modal, but I can click the below button.

How can the dialog prevent that?

thanks Paulo Aboim Pinto

SKProCH commented 3 weeks ago

Its always modal, actually. Make sure what OverlayBackground is properly assigned (or try to manually assign a color to that properly). By default it tries to use the SystemControlBackgroundBaseHighBrush resource (from fluent theme), or Black color if that resource is not found.

aboimpinto commented 3 weeks ago

Hello,

Thanks for the quick answer ... I've made a small video showing that it is possible that this is not working.

https://youtu.be/pb3016tn6J8

Sorry about the volume, but I did this in the middle of the night, and I didn't want to wake up the family. You can follow the video and see that the popup is not modal.

thanks Paulo Aboim Pinto

SKProCH commented 3 weeks ago

Oh, got you problem. Actually you need to wrap the underling content to DialogHost. E.g. from your example:

image

It will be something like that:

<DialogHost ...>
  <Grid>
    <Button>Open</Button>
  </Grid>
</DialogHost>

So, basically DialogHost should be your view root.