Skip to content

Regarding when a WPF application using the "PresentationFramework.Fluent" theme experiences a flashing window in dark mode. #10513

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

Open
jcddcjjcd opened this issue Feb 27, 2025 · 11 comments

Comments

@jcddcjjcd
Copy link

I have converted 4 apps with extensive use of windows to PresentationFramework.Fluent and aside from issues already raised I am quite happy with it except that most of the time when Dark Mode windows open there is a brief flash of white before the window is drawn, this is immediately after window.Show() and before the redraw starts.
I haven't seen it mentioned here yet but an AI search describes it and the felling is that this a Windows problem rather than WPF.
This issue is an absolute show stopper as it is very jarring and widespread.
I am running the latest Windows11, an Intel Ultra 9 285k CPU and an Nvidia 4060 GPU so processing speed is unlikely an issue.
Is this widespread and will a solution be found is what I am really asking.
Would anyone like to comment.

@himgoyalmicro
Copy link
Contributor

@jcddcjjcd Can you please provide a sample repro project and if possible, a video of the issue?

@jcddcjjcd
Copy link
Author

jcddcjjcd commented Mar 11, 2025

A small video clip.
https://github.com/user-attachments/assets/a182dd00-4d03-4766-84ca-3abc83a3ed26
I can't post the code here but would consider sending it privately.
This flicker is typical and for some windows constant while others are intermittent perhaps depending on what else is going on in the app or the complexity of the page.

@dotnet-policy-service dotnet-policy-service bot removed the 📭 waiting-author-feedback To request more information from author. label Mar 11, 2025
@luolinlin768
Copy link

这个问题不仅存在于使用了Fluent 主题中项目中
在没有应用Fluent主题的程序中也有
我认为这个问题在以暗色为主的程序中是相当难以接受的
以下是视频

2025-04-01_16-55-00.mp4

This problem is not limited to projects that use Fluent themes
There are also programs that don't have the Fluent theme applied
I think this problem is quite difficult to accept in a predominantly dark program
Below is the video

2025-04-01_16-55-00.mp4

@lindexi
Copy link
Member

lindexi commented Apr 1, 2025

Reference: #5853 , but I do not think it is the same issues.

@lindexi
Copy link
Member

lindexi commented Apr 1, 2025

@luolinlin768 Can you upload your code?

能否将代码项目也传上来?

@luolinlin768
Copy link

这是项目文件,我压缩上传上来了
我看了你提到的issue,我自己试过一些程序也有该问题,但也有的程序没有该问题
我的问题解决了,非常感谢你的解答

This is the project file, I compressed and uploaded it
I read the issue you mentioned, and I've tried some programs myself that also have this problem, but there are also programs that don't have this problem
My question solved, thank you very much for the answer

WpfApp.zip

@lindexi
Copy link
Member

lindexi commented Apr 2, 2025

@luolinlin768 你的问题是如何解决的呢?

How was your problem solved?

@JingeOnline
Copy link

@lindexi 我用下面的方法解决了自己项目中的这个问题:
在WPF项目的启动Window中,添加 AllowsTransparency="True" 属性,这样启动后就不会闪烁白色窗口。

English: I use the following method solve my own problem, In my WPF project startup window, add AllowsTransparency="True" property. After that, the flasing white screen is gone when launch my app.

Example:

<Window x:Class="WPF_WebScreenSaver_Project.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        ......
        AllowsTransparency="True">

@lindexi
Copy link
Member

lindexi commented May 12, 2025

@JingeOnline Thank you. But the AllowsTransparency may cause the preformance issues.

非常感谢,但 AllowsTransparency 可能会有性能问题,请看 WPF 从最底层源代码了解 AllowsTransparency 性能差的原因

@JingeOnline
Copy link

@lindexi 可以在窗口渲染完成之后把 AllowsTransparency再设置回false,这样应该就不影响性能了吧。

@lindexi
Copy link
Member

lindexi commented May 12, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

5 participants