MessageBox.Avalonia icon indicating copy to clipboard operation
MessageBox.Avalonia copied to clipboard

ShowAsPopupAsync broken in Avalonia 11.1.0

Open SCLD-ARowe opened this issue 1 year ago • 11 comments

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.

SCLD-ARowe avatar Jul 23 '24 14:07 SCLD-ARowe

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

CreateLab avatar Jul 30 '24 10:07 CreateLab

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.

SCLD-ARowe avatar Jul 30 '24 14:07 SCLD-ARowe

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

filipnavara avatar Jul 31 '24 20:07 filipnavara

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

TheRealEamonCS avatar Aug 12 '24 15:08 TheRealEamonCS

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

Upanc avatar Aug 21 '24 09:08 Upanc

@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 ;-)

EishaV avatar Aug 28 '24 06:08 EishaV

@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

Upanc avatar Aug 28 '24 10:08 Upanc

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?

EishaV avatar Aug 28 '24 12:08 EishaV

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

Upanc avatar Aug 29 '24 08:08 Upanc

@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.

TheRealEamonCS avatar Sep 02 '24 06:09 TheRealEamonCS

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

sedwick2048 avatar Sep 30 '24 22:09 sedwick2048