Skip to content

Title bar lags behind when resizing #13479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PerfectlyFineCode opened this issue Feb 21, 2023 · 11 comments · Fixed by #14517
Closed

Title bar lags behind when resizing #13479

PerfectlyFineCode opened this issue Feb 21, 2023 · 11 comments · Fixed by #14517
Labels
area-controls-window Window area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter fixed-in-8.0.0-preview.4.8333 Look for this fix in 8.0.0-preview.4.8333! platform/windows 🪟 t/bug Something isn't working t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK) t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)

Comments

@PerfectlyFineCode
Copy link

PerfectlyFineCode commented Feb 21, 2023

Description

The title bar lags behind when resizing the window for Windows.

explorer_tS0jgo8SMC.mp4

Steps to Reproduce

1.) Create a new .NET MAUI App project
2.) Start the app
3.) Resize the window horizontally.
4.) The title bar should now lag behind

Link to public reproduction project repository

https://github.com/PerfectlyFineCode/RecipeManager

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 11 (22621.1265)

Did you find any workaround?

#13479 (comment)

Relevant log output

No response

@PerfectlyFineCode PerfectlyFineCode added the t/bug Something isn't working label Feb 21, 2023
@Eilon Eilon added the legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) label Feb 21, 2023
@Eilon
Copy link
Member

Eilon commented Feb 21, 2023

I wonder if this is an issue in WinUI itself?

@Eilon
Copy link
Member

Eilon commented Feb 21, 2023

This doesn't seem to happen on a default WinUI3 app. And regarding MAUI, even if I remove every non-absolutely-required thing from a default MAUI project, it still has that little bit of lag in the title bar.

  1. Create new MAUI project (.NET 7)
  2. Remove all AppShell, custom fonts, etc.
  3. Change MainPage to have just a Label, and set it as the main page in App.xaml.cs
  4. Run the app
  5. Resize the window's width back and forth rapidly

Result: The "min/max/restore" buttons have some lag and delay their movement a tiny bit. This is on a very high end modern machine.

This strikes me as possibly a performance issue, such as something re-computing during every resize, and causing other UI artifacts such as this.

Also worth noting: I tested this in "Release" configuration, without a debugger attached. Still happens.

@Eilon Eilon added the legacy-area-perf Startup / Runtime performance label Feb 21, 2023
@rachelkang rachelkang added this to the Backlog milestone Feb 22, 2023
@rachelkang rachelkang added area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter area-controls-window Window labels Feb 22, 2023
@rachelkang
Copy link
Member

@hartez "related to ContentPanel sizing issues"

@ghost
Copy link

ghost commented Feb 22, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@sibber5
Copy link

sibber5 commented Feb 22, 2023

this is a winui 3 issue: microsoft/microsoft-ui-xaml#5446

@sibber5
Copy link

sibber5 commented Feb 22, 2023

i think the only solution is to not render the titlebar in winui, i.e. use a native titlebar. (at least until the winui issue gets resolved, which is very unlikely)

@Eilon
Copy link
Member

Eilon commented Feb 22, 2023

this is a winui 3 issue: microsoft/microsoft-ui-xaml#5446

Oh, does MAUI "custom draw" the title bar? I don't know that part of the codebase, but if that's the case, then it does sound like that.

@hartez
Copy link
Contributor

hartez commented Feb 23, 2023

This doesn't seem to happen on a default WinUI3 app.

Default WinUI 3, or default UWP app? Because in addition to microsoft/microsoft-ui-xaml#5446, there's also microsoft/microsoft-ui-xaml#2506 and microsoft/microsoft-ui-xaml#5148.

Oh, does MAUI "custom draw" the title bar? I don't know that part of the codebase, but if that's the case, then it does sound like that.

We don't draw the default title bar. I think they're referring to a native Windows titlebar, as opposed to whatever WinUI is doing.

@sibber5
Copy link

sibber5 commented Feb 23, 2023

all those issues are talking about the same issue.
the 'flickering" is the content resize being slow and showing the actual background color which is white if your using light mode, and black if you're using dark mode.

as you can see in all of those the title bar does not resize slowly with the rest of the window, because winui 3 uses a native titlebar.

also afaik winui 3 is a seperate framework than uwp. you can either use uwp + winui 2, or winui 3.
I think what they mean by winui 3 uwp is packaged winui 3.
uwp does not suffer from this issue.

@Eilon
Copy link
Member

Eilon commented Feb 23, 2023

This doesn't seem to happen on a default WinUI3 app.

Default WinUI 3, or default UWP app? Because in addition to microsoft/microsoft-ui-xaml#5446, there's also microsoft/microsoft-ui-xaml#2506 and microsoft/microsoft-ui-xaml#5148.

A default WinUI3 desktop project. Not UWP.

@hartez
Copy link
Contributor

hartez commented Feb 23, 2023

So we customize the title bar for a WinUI MAUI app, but we're just using the built-in WinUI methods for doing so. Nothing extreme, and it's just using WinUI controls. But as soon as we start doing that, the same resizing problem that happens for window content starts happening with the title bar.

For users who want to work around this (until it's fixed at the WinUI level), you can use the default Windows title bar as @cyberrex5 is suggesting. Just add this to your MauiProgram.cs to disable the MAUI customizations:

#if WINDOWS
Microsoft.Maui.Handlers.WindowHandler.Mapper.Add("UseDefaultTitleBar", (handler, _) => { handler.PlatformView.ExtendsContentIntoTitleBar = false; });
#endif

That will disable all the MAUI customizations.

@PureWeen PureWeen modified the milestones: Backlog, .NET 8 Apr 13, 2023
@PureWeen PureWeen moved this from Todo to In Progress in MAUI SDK Ongoing Apr 13, 2023
@samhouts samhouts closed this as completed May 2, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in MAUI SDK Ongoing May 2, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 1, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.4.8333 Look for this fix in 8.0.0-preview.4.8333! label Jun 8, 2023
@Eilon Eilon added the t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK) label May 10, 2024
@Eilon Eilon added t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) and removed legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) legacy-area-perf Startup / Runtime performance labels May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-window Window area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter fixed-in-8.0.0-preview.4.8333 Look for this fix in 8.0.0-preview.4.8333! platform/windows 🪟 t/bug Something isn't working t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK) t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants