wpf icon indicating copy to clipboard operation
wpf copied to clipboard

Apps with a custom background flash a white background for a couple frames on some devices

Open 1ctinus opened this issue 3 years ago • 11 comments
trafficstars

  • .NET Core Version: (e.g. 3.0 Preview1, or daily build number, use dotnet --info) 6.0.100
  • Windows version: (winver) Windows 11 10.0.22000
  • Does the bug reproduce also in WPF for .NET Framework 4.8?:
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? If yes, please file the issue via the instructions here.
  • Security issues and bugs should be reported privately, learn more via our responsible disclosure guidelines.

Problem description: Apps with a custom background flash a white background for a couple frames on some devices (previously asked Stack overflow to no avail, pointed to likely a software issue) Actual behavior: Window flashes white before fully loading. Expected behavior: Window opens with the correct background color instantly Minimal repro:

dotnet new wpf

edit MainWindow.xaml to have a background attribute

dotnet build

and run the app.

1ctinus avatar Dec 19 '21 00:12 1ctinus

@1ctinus Is this issue reproducible on previous windows versions/ previous version of .Net Core/ Framework also?

singhashish-wpf avatar Dec 20 '21 05:12 singhashish-wpf

I compiled the program using msbuild 4.8 and running it on the latest version of dotnet, on a separate device running windows 10. the issue persisted.

1ctinus avatar Dec 21 '21 14:12 1ctinus

This also started to happen on my machine like a week ago. It's does not seem to be isolated to WPF as it also happens with Edge. See (increased gif frame delay to 250 ms to make it really visible): window_white_flash

batzen avatar Dec 21 '21 19:12 batzen

I am also having this exact same issue with win32 too.

1ctinus avatar Dec 26 '21 00:12 1ctinus

@1ctinus Can you please use Windows feedback channel to take this up. Hopefully, this issue can be closed.

vishalmsft avatar Dec 27 '21 09:12 vishalmsft

I'm having the same issue, WPF on DOT NET CORE opens the window slower too, about 2 seconds slower. However WPF on dot.net 4.8 sometimes didn't open at all periodically and just hung, at least they fixed that after 15 years...

ZionGates avatar Mar 01 '22 14:03 ZionGates

This is a very old known issue of WPF.

In fact, this has been annoyance since 2005! https://social.msdn.microsoft.com/Forums/en-US/3960d6a6-e873-455c-9ddc-1e2dd32e090b/flickering-background-when-resizing-window?forum=wpf

The white background flash happens at start up and window resize (including maximizing). This is so obvious with a Window with fairly complex XAML layout with custom title bar using WindowChrome.

I can't believe this "bug" is still present in 2023.

torum avatar Mar 03 '23 10:03 torum

@torum As i already wrote above, this is not a pure WPF issue. The underlying problem is caused by Windows itself. ControlzEx has code to mitigate the white flash and the resize flickering.

batzen avatar Mar 03 '23 11:03 batzen

I would like to mention this workaround from SO. Just set Window Opacity to 0 and then in Loaded event set it back to 1. Its dirty workaround but seems to be ok in my case.

JanHadascok avatar Apr 13 '24 13:04 JanHadascok

Any updates on this?

mhrastegari avatar Aug 12 '24 07:08 mhrastegari

@mhrastegari Could you describe your problem? As same as the author's ? And I think it is the Windows's issues not wpf

lindexi avatar Aug 12 '24 09:08 lindexi