I've been trying to convert Metronic demo39 HTML to a Blazor project, and it loads and renders fine on the first load, but as soon as I navigate to a different route, the data-bs-theme that Metronic adds onto the <html> element is being removed, causing formatting from the CSS/SCSS to break.
I've been trying to add a few breakpoints onto the various bits of code in scripts.bundle.js as well as the inline javascript at the top of the body element which handles this, but I can't figure out what's causing the HTML data element to be removed on clicks.
Any Suggestions?
Hi,
Thank you for reaching out to us.
Do you initialize KTThemeMode component?
JS.InvokeVoidAsync("KTThemeMode.init");
I am using a Blazor Web App, rather than a Blazor Server or WebAssembly, on .NET 8.0.
I've tried the execution of the KTThemeMode.init using the following on the MainLayout.razor file:
@inject IJSRuntime JsRuntime
@code {
protected override void OnAfterRender(bool firstRender)
{
JsRuntime.InvokeVoidAsync("KTThemeMode.init");
}
}
I've managed to get it working by changing some of the rendering mode.
I will look at what other things need to be initialised on navigation, thanks for the help.
Hi,
Glad to hear you managed to fix it. Please don't hesitate to reach out if you need any additional help.
Regards,
Lauris Stepanovs,
Keenthemes Support Team