Description
Background and motivation
With the introduction of FluentWindows ( Win11 ) theme, we want to allow developers to be able to enable disable and switch themes in their WPF applications. Irrespective of if we provide an API in .NET 9, I believe that we should provide a way for developers to choose only Light, Dark theme or respond to system theme changes.
Part of effort - #8655
This is inspired and a minified version of the #8759
Before going through the alternatives, I would like to bring to the point, since we are so close to the code completion deadline for .NET Preview 7, that if we choose to implement the API, we keep it experimental, so that we have room for further discussion in future.
API Proposal
Current Proposal
public class Application
{
[Experimental]
public string Theme { get; set; }
}
public class Window
{
[Experimental]
public string Theme { get; set; }
}
The accepted values for the theme properties can be - None
, System
, Light
and Dark
As mentioned above, these APIs will be Experimental
until we have further discussions and have a better way to handle theme ( default ) styles in .NET 10.
Behavior of the APIs
- When
Window.Theme = System / Light / Dark
it will take precdence overApplication.Theme
and we will load the Fluent styles for window. In case, ofSystem
Window will respond to System theme changes. - When
Application.Theme = System / Light / Dark
andWindow.Theme = None
then window will follow the application. - In case none of the above properties are set, we will get
Aero2
by default. - Accent color changes will be received by every window irrespective of the Theme property values. If Theme value is
None
, then Accent colors don't come into play. - Default values for both
Theme
properties isNone
.
Alternative Designs
No response
Risks
No response
cc: @dotnet/dotnet-wpf-triage @pomianowski
Metadata
Metadata
Assignees
Labels
Type
Projects
Status