microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.3k stars 676 forks source link

ContentDialog resize and reposition issues with XAML Islands #7401

Open aquinn39 opened 2 years ago

aquinn39 commented 2 years ago

Describe the bug

When using XAML Islands, ContentDialogs do not handle window size changes very well. This isn't a very good user experience. From my testing, ContentDialogs created programatically do not reposition at all when the window size is changed, also the darkened background that shows over the UI when a ContentDialog present does not resize. When a ContentDialog is defined in XAML, however, the dialog does reposition but the darkened background still does not resize. This issue does not seem to affect UWP apps.

Steps to reproduce the bug

  1. Create an app that uses WinUI 2 with XAML Islands (Tutorial here: https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands).
  2. Create a ContentDialog in XAML and show it.
  3. Create a ContentDialog programatically, set the XAMLRoot to the one where you want to show it and show it.

Expected behavior

The ContentDialog should always be in the centre of the XAML Island and the smoke should always cover the whole Island.

Screenshots

ContentDialog created programatically:

https://user-images.githubusercontent.com/43898231/180009852-f55b005e-9250-4463-b257-4507ca846cec.mp4

ContentDialog created in XAML:

https://user-images.githubusercontent.com/43898231/180010127-abbbdcce-5a03-4c97-a8da-fe2e74655f2b.mp4

NuGet package version

Microsoft.UI.Xaml 2.8.0

Windows app type

Device form factor

Desktop

Windows version

Windows 11 (21H2): Build 22000

Additional context

No response

aquinn39 commented 2 years ago

Might be related to https://github.com/microsoft/microsoft-ui-xaml/issues/3577 though I'm not sure if that issue is specific to XAML Islands.

aquinn39 commented 2 years ago

This seems to affect ContentDialogs regardless of if they use WinUI 2 or not so reported the issue on Feedback Hub as well. https://aka.ms/AAhimaz

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

aquinn39 commented 1 year ago

This issue still exists. I have seen some Microsoft apps such as Snipping Tool and Notepad attempt to work around this by preventing the user from resizing the window when a ContentDialog is open, or close the currently open ContentDialog, but these are very poor workarounds and make for a poor user experience - not a good look for in built apps in the latest version of Windows. I know WinUI 2, UWP and the system XAML Host are not getting much attention anymore, but considering they are used in many inbox Windows user interfaces, I think issues like this should be addressed.

zadjii-msft commented 3 months ago

@bpulliam y'all may want to de-dupe this with #3577. I'm thinking that thread's effectively the same thing, and has more info in it (including a workaround).

codendone commented 2 months ago

We took a look and currently prefer to keep both issues. This bug is the broader bug. There are a bunch of issues with ContentDialog sizing which get exacerbated when resizing. #3577 seems to be specific to one scenario amongst those issues.