microsoft / microsoft-ui-xaml

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

WinUI 3 (Win32 and UWP) lags in resizing #2506

Open BreeceW opened 4 years ago

BreeceW commented 4 years ago

Describe the bug UWP XAML windows fairly smoothly fit their content to the window as it is resized. WinUI 3 apps, both Win32 and UWP, do not. Win32 apps reveal a white background underneath, and UWP apps reveal the splash screen background color (yellow in the middle GIF below).

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Open a Win32 or UWP app that uses WinUI 3
  2. Drag the edge of the window to resize it and observe a delay and undesirable colors as the content fits the window

Expected behavior There should be only unnoticeable delay in the content resizing to fit the window, like in UWP XAML.

Screenshots UWP XAML (expected behavior) WinUI 3 UWP (undesirable) WinUI 3 Win32 (undesirable)
UWP XAML Resizing WinUI 3 UWP Resizing WinUI Desktop Resizing

Version Info

NuGet package version: Microsoft.WinUI 3.0.0-preview1.200515.3

Windows 10 version Saw the problem?
Insider Build (xxxxx)
November 2019 Update (18363) Yes
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Mobile
Xbox
Surface Hub
IoT
StephenLPeters commented 4 years ago

@bartekk8 for FYI

gsuberland commented 3 years ago

Possibly related to #2203, which shows "Window resized" as taking a long time in the perf trace on startup.

ForUx2 commented 8 months ago

This code can hide the flashing emitted while the window size changes


#include "microsoft.ui.xaml.window.h"
#include <winrt/Microsoft.UI.Interop.h>
#include <winrt/Microsoft.UI.Windowing.h>

  auto windowsNative{ this->m_inner.as<IWindowNative>() };
  HWND hwnd{ 0 };
  windowsNative->get_WindowHandle(&hwnd);

  // Retriver the windiws id that corresponds to hwnd
  Microsoft::UI::WindowId windowsId = Microsoft::UI::GetWindowIdFromWindow(hwnd);

  // Lastly,...
  Microsoft::UI::Windowing::AppWindow AppWindow = Microsoft::UI::Windowing::AppWindow::GetFromWindowId(windowsId);

  SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
brianmichel commented 8 months ago

Any updates/thoughts here from the Microsoft side? This defect is widespread enough (including apps like Edge) that I think it's worth reengaging with.

mgood7123 commented 8 months ago

i agree, basic resizing of an extremely simple window should be a very smooth transition, not a laggy one