Skip to content

DesignThemeModes have 3 but need 4? #3016

Closed Answered by pmeems
pmeems asked this question in Q&A
Discussion options

You must be logged in to vote

I think I found a solution.

The FluentDesignTheme has an OnLoaded event, which I can use.

<FluentDesignTheme StorageName="theme"
                   CustomColor="#CC3300"
                   OnLoaded="OnloadedTheme"
                   @bind-Mode="@Mode"/>
    private void OnloadedTheme(LoadedEventArgs loadedEventArgs)
    {
        if (loadedEventArgs.Mode == DesignThemeModes.System)
        {
            if (loadedEventArgs.IsDark)
            {
                Mode = DesignThemeModes.Dark;
                ClassValue = "toolbarButton darkTheme";
        }
    }

In the OnLoaded event I check if the Mode is DesignThemeModes.System and then I check if the System prefers dark mode.
If so I exp…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

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

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