Replies: 2 comments 2 replies
-
|
You can see how we did it in the demo site. The code is in the repository in the examples folder |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
@nangusa |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I came here to ask because I don't know how to make the default theming to work.
I'm trying to add the user the options to change from light theme to dark. I'm following the instructions given in the documentation (https://www.fluentui-blazor.net/DesignTheme) but it doesn't work as I expect, so I'm doing something wrong but I don't know what.
My project is a Blazor Server app with auto rendering from the Fluent template. I added to my App.razor file the following, per documentation:
Then, in my MainLayout.razor file I added:
<FluentDesignTheme Mode="DesignThemeModes.Dark" OfficeColor="OfficeColor.Word" />The problem I have is that when changing pages in the app, the theme resets. For example, using the default project template, if I click on "Counter" to go to the Counter page, the theme restores to system when it was black in the Home page. Also, sometimes child components doesn't render with the right theme, so the page renders parts in dark mode, parts in system or light mode.
Also, sometimes navigating back and forth between pages and/or components solve the problem and the entire application stays at the desired color theme for the rest of the session, which it's weird and I don't understand why this happens.
I tried with a custom component on which I added the example code in the documentation to allow the user to change themes. I added this component to the top of the MainLayout.razor file to be available in all the application's pages. This code works as expected by changing the theme on the fly when the user changes it, but as soon as he navigates to another page, the theme resets again and the strange behaviour I wrote earlier appears.
I'm here because I'm lost right now. I tried theming as per documentation starting from a fresh project template and the behaviour is the same, so I'm needing some advise about what I could be doing wrong, or something new to try to get it working.
Thanks in advance and have a good day.
Beta Was this translation helpful? Give feedback.
All reactions