Skip to content

AppTheme bindings For Dark/light modes #143

Answered by Dreamescaper
roughiain asked this question in Q&A
Discussion options

You must be logged in to vote

There are multiple options.

  1. Set style directly in razor (e.g. AppTheme.Light ? Colors.White : Colors.Black). Not really pretty, but might work for the simplest apps.

  2. Build a resource dictionary with C#, and apply it to your application globally or per control.

  3. Build the same resource dictionary with XAML. I don't really like xaml for layout trees (hence this project), but for styles only - why not.

  4. You can also use css stylesheet, but I don't advise it - it's quite limited, and not really supported by MAUI devs anymore.

Those options have their difficulties, so I'll try to create a sample demonstrating them soonish .

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@roughiain
Comment options

Answer selected by roughiain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants