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

Switching theme loses transparency #1163

Open
Apskalle opened this issue Jul 22, 2024 · 4 comments
Open

Switching theme loses transparency #1163

Apskalle opened this issue Jul 22, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Apskalle
Copy link

Describe the bug

When switching light to dark (or other way around) mica or acrylic transparency is lost.

To Reproduce

Can be tried on simple demo (https://github.com/lepoco/wpfui/tree/main/src/Wpf.Ui.Demo.Simple/)

Expected behavior

Theme should remain transparent

Screenshots

Before_after

OS version

Windows 11 Pro
Version 23H2
OS-version 22631.3880
Windows Feature Experience Pack 1000.22700.1020.0

.NET version

net 8.0, SDK 9 preview

WPF-UI NuGet version

3.0.4

Additional context

No response

@Apskalle Apskalle added the bug Something isn't working label Jul 22, 2024
@tonyrichter
Copy link

Ah that's what I was noticing. I did notice a slight color change but wasn't really sure about it because I used TeamViewer and colors are strange there anyway.

Can confirm!

@duyle1402
Copy link

I facing same problem when using latest version 3.0.5.

@Apskalle
Copy link
Author

Apskalle commented Aug 9, 2024

Update: Backdrop changing works fine if you instead of using ApplicationThemeManager.Apply() bind the windows WindowBackdropType property (change notification needed)

<ui:FluentWindow x:Class="Core.Login"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        ...
          xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
          WindowBackdropType="{Binding MyThemeManager.SelectedTheme.WindowBackdropType}"
          ExtendsContentIntoTitleBar="True">

@yuyoyuppe
Copy link

My MainWindow must preserve transparency, and I use tray:NotifyIcon without ui:FluentWindow, thus I don't need backdrop functinonality. However, to facilitate tray menu reacting to theme changes, I've had to use the following code to workaround the issue with this code:

private void UpdateWPFUITheme(bool darkMode) {
    ApplicationTheme theme = darkMode ? ApplicationTheme.Dark : ApplicationTheme.Light;
    Window? mainWindow = UiApplication.Current.MainWindow;
    UiApplication.Current.MainWindow = null;
    ApplicationThemeManager.Apply(theme, Wpf.Ui.Controls.WindowBackdropType.None, false);
    UiApplication.Current.MainWindow = mainWindow;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants