Skip to content
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

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

Merged
merged 1 commit into from
Jun 2, 2024

Conversation

Muniwedesu
Copy link
Contributor

@Muniwedesu Muniwedesu commented May 20, 2024

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

Issue Number: #927

What is the new behavior?

  • backdrop is applied correctly

Other information

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

@github-actions github-actions bot added themes Topic is related to managing themes PR Pull request dotnet labels May 20, 2024
@nabeelio
Copy link

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
Copy link
Contributor Author

@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
Copy link

nabeelio commented May 23, 2024

@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
Copy link
Contributor Author

@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
Copy link

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

@Muniwedesu
Copy link
Contributor Author

Muniwedesu commented May 23, 2024

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

@pomianowski pomianowski merged commit 232b9c6 into lepoco:development Jun 2, 2024
2 checks passed
@pomianowski pomianowski changed the title fix non-legacy backdrop when switching themes Fix non-legacy backdrop when switching themes and applying Mica or other effect Jun 11, 2024
@Jay-o-Way Jay-o-Way mentioned this pull request Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet PR Pull request themes Topic is related to managing themes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants