lepoco / wpfui

WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.
https://wpfui.lepo.co
MIT License
7.47k stars 725 forks source link

Fix non-legacy backdrop when switching themes and applying Mica or other effect #1094

Closed Muniwedesu closed 4 months ago

Muniwedesu commented 4 months ago

Pull request type

Please check the type of change your PR introduces:

What is the current behavior?

Issue Number: #927

What is the new behavior?

Other information

checked on windows 11 22631 build and on windows 10 19045 build (only default light/dark themes with simple demo app)

nabeelio commented 4 months ago

I'm trying this out based on your last comment (nice timing!), but it's setting the entire window to transparent, instead of applying the Mica background to the navigation control

Muniwedesu commented 4 months ago

@nabeelio afaik mica bg is drawn under the window (as this is set through winapi) and then it will be visible on different controls (including window) only when they either don't have background or the background is transparent, so window bg removal is intended. Though, if it isn't displayed at all, you seem to have some other stuff happening (is your window becoming literally transparent or it just has black/white bg?). Firstly, you should probably check if your OS build supports this effect. It also seems to do nothing if you have backdrop effect set to "Auto", so make sure you set proper backdrop when applying theme.

nabeelio commented 4 months ago

@Muniwedesu thanks - that's interesting. I'm on Windows 11. And yes, setting this, it applies the transparency to everything. I'm converting this over from ModernWPF (removed everything). My window backdrop type is set to Mica. I'm assuming it might be an app.manifest file problem

image

Muniwedesu commented 4 months ago

@nabeelio maybe something else is changing background settings through winapi after you swap themes - wpfui sets your window background to black/white when you apply any theme, so the window should never become transparent.

nabeelio commented 4 months ago

Yeah, maybe. It's very strange. I'll continue debugging, but good to know your fix works as intended! Thank you

Muniwedesu commented 4 months ago

Check if you have these attributes set in your window tag or if something is doing the same somewhere in your code, wpf apps normally cannot be fully transparent (you should remove them) image