AvaloniaCommunity / MessageBox.Avalonia

Messagebox for AvaloniaUI
MIT License
444 stars 55 forks source link

ShowAsPopupAsync broken in Avalonia 11.1.0 #185

Open SCLD-ARowe opened 3 months ago

SCLD-ARowe commented 3 months ago

Hi, after upgrading to Avalonia 11.1.0 the ShowAsPopupAsync() method is no longer working as expected. When displayed it no longer grays out the screen behind it nor does it prevent a user from interacting with that screen. It also sometimes displays with the text behind it overlayed on top of the popup.

None of these were issues with 11.0.11. It's only after the latest upgrade. ShowWindowDialogAsync is working as expected, so I am using that instead for now.

CreateLab commented 2 months ago

fixeed here https://github.com/AvaloniaCommunity/MessageBox.Avalonia/pull/182

SCLD-ARowe commented 2 months ago

Is this in a released version? I'm still having the same issues using MessageBox 3.1.6 with both Avalonia 11.1.0 and 11.1.1.

filipnavara commented 2 months ago

I can confirm it still happens on browser with Avalonia 11.1.1 and MessageBox 3.1.6.

TheRealEamonCS commented 2 months ago

This issue also occurs on my Android app (both emulator and hardware) using the very latest Avalonia 11.1.2 and MessageBox 3.1.6. ShowWindowDialogAsync works as expected on the Windows/Linux/MacOS app versions but ShowAsPopupAsync displays a transparent non-modal popup in both light and dark modes. Hopefully nobody minds if I attach a light mode image.

TransparentAndroidPopup

Upanc commented 2 months ago

This issue also occurs on my Android app (both emulator and hardware) using the very latest Avalonia 11.1.2 and MessageBox 3.1.6. ShowWindowDialogAsync works as expected on the Windows/Linux/MacOS app versions but ShowAsPopupAsync displays a transparent non-modal popup in both light and dark modes. Hopefully nobody minds if I attach a light mode image.

TransparentAndroidPopup

usercontrol background=white

EishaV commented 1 month ago

@Upanc Sorry please explain "usercontrol background=white"

A workaround is to manipulate the UserControl via styles. But that's not pretty!

  <Application.Styles>
    <FluentTheme DensityStyle="Compact"/>
    <Style Selector=":is(UserControl)[Padding=15]">
      <Setter Property="Background" Value="{DynamicResource Box}"/>
    </Style>
  </Application.Styles>
  <Application.Resources>
    <ResourceDictionary>
      <ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary x:Key="Light">
          <SolidColorBrush x:Key='Box'>White</SolidColorBrush>
        </ResourceDictionary>
        <ResourceDictionary x:Key="Dark">
          <SolidColorBrush x:Key='Box'>Black</SolidColorBrush>
        </ResourceDictionary>
      </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary>
  </Application.Resources>

(UserControl of MsBoxStandardView is the only one with padding 15 ;-)

Upanc commented 1 month ago

@Upanc Sorry please explain "usercontrol background=white"

A workaround is to manipulate the UserControl via styles. But that's not pretty!

  <Application.Styles>
    <FluentTheme DensityStyle="Compact"/>
    <Style Selector=":is(UserControl)[Padding=15]">
      <Setter Property="Background" Value="{DynamicResource Box}"/>
    </Style>
  </Application.Styles>
  <Application.Resources>
    <ResourceDictionary>
      <ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary x:Key="Light">
          <SolidColorBrush x:Key='Box'>White</SolidColorBrush>
        </ResourceDictionary>
        <ResourceDictionary x:Key="Dark">
          <SolidColorBrush x:Key='Box'>Black</SolidColorBrush>
        </ResourceDictionary>
      </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary>
  </Application.Resources>

(UserControl of MsBoxStandardView is the only one with padding 15 ;-)

here MsBoxCustomView.axaml,It's useful to me

EishaV commented 1 month ago

I haven't found any examples or Wiki of how to use Custom. I just want to use MsBox Standard from the nuget package without any adjustments and not manipulate the source code.

What does your solution look like in the code?

Upanc commented 1 month ago

I haven't found any examples or Wiki of how to use Custom. I just want to use MsBox Standard from the nuget package without any adjustments and not manipulate the source code.

What does your solution look like in the code?

clone this project and build

TheRealEamonCS commented 1 month ago

@Upanc, @EishaV: Thank you both for the feedback, this is good stuff, I'll fiddle with it and see if I can resolve the issue. If I can get it working, I'll post my solution.

sedwick2048 commented 3 weeks ago

I got ShowWindowDialogAsync to do the job, although I don't know how to hide the title bar buttons:

        var box = MessageBoxManager.GetMessageBoxStandard("Not Implemented", "Opening of sensitivity parameters\nis not yet implemented.", ButtonEnum.Ok);
        var result = box.ShowWindowDialogAsync(TopLevel.GetTopLevel(this) as Window);

image