dotMorten / WinUIEx

WinUI Extensions
https://dotmorten.github.io/WinUIEx
MIT License
572 stars 36 forks source link

Cant set Dark theme #108

Closed tinmac closed 1 year ago

tinmac commented 1 year ago

Hi @dotMorten I use WinUiE & its very usefull, many thanks for toolkit.

There is an issue with setting a WindowEx to the dark theme, it flashes/blinks Dark momentarily but remains Light. When i narrowed it down to WinUiEx I jumped here to see if WinUiEx supported theme changes in case there was a clash but this isnt the case.

Here is a basic project to demonstrate the problem.

tinmac commented 1 year ago

Ok so now I see the WindowContent property. I have re-written the WindowEx ctor code

from this

var content = this.Content as FrameworkElement;
content.RequestedTheme = ElementTheme.Dark;

To this

var content = this.WindowContent as FrameworkElement;
content.RequestedTheme = ElementTheme.Dark;

Which works but there is a blink/flash from light to dark when the window opens, is there a way to avoid/fix this?

tinmac commented 1 year ago

You can see the flash in your sample app if you set the theme to Dark and then switch between Mica & Acrylic.

dotMorten commented 1 year ago

The backdrop APIs has been removed in favor of the new Microsoft-provided APIs in v1.3 - let me know if you still see an issue, but in that case it's most likely a winappsdk issue.