dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.03k stars 1.16k forks source link

WindowBackdropStyle public accessibility #9496

Open optimus-code opened 1 month ago

optimus-code commented 1 month ago

I am testing out the .NET 9 preview, specifically the WPF Fluent UI introductions. I was following the Mica guidance docs on the MS website where it mentions using MicaAlt depending on your use-case. (https://learn.microsoft.com/en-us/windows/apps/design/style/mica#when-to-use-mica-or-mica-alt)

I tracked this down to WindowBackdropType on Window, which has been made internal only. Changing this to TabbedWindow (4) via reflection results in giving the mentioned MicaAlt backdrop on your window.

Are there any plans to make this configurable by developers? Being able to configure this is vital if you are trying to follow the design guidelines set out in the MS docs.

dipeshmsft commented 1 month ago

Hey @optimus-code, yes we are planning to make this property public in .NET 10.

However, if you are planning to use this via reflection for now, you will need to handle the scenario of theme change as the backdrop will get reset to MainWindow for now.

Alternatively, you can use the app context switch ( Switch.System.Windows.Appearance.DisableFluentThemeWindowBackdrop ) to disable backdrop being applied and manage the backdrop in your app for time being. However, we will remove this switch when we will introduce the property in .NET 10.