I am building a test app using Blazor .NET 8 RC1, and have pasted one of your basic layout examples into the MainLayout page.
However when I run the app, the toggle and menu items do not respond.
I know .NET 8 is not yet released and therefore still not supported, but any feedback would be greatly appreciated.
This is the code example I have used:
I have the side menu not expanding/collapsing at all and also dropdown menus are not activating when pushed, even if the data has loaded.
Any idea what could be the issue?
I have done a completely new one, following the installation instructions from your website and I have a video shows how the UI elements are not responding to the several mouse clicks I do on both the menu expand/collapse, but also on the dropdown menu and no errors are popping up anywhere.
I am really at a loss here to what can be the reason and hope you can help.
I have attached a zip file with the full project.
I reproduced the problem. Unfortunately it seems that no events execute in the layout. I tested by adding a vanilla button click there and nothing happened.
Can you try this yourself? The counter in the header should increment but it doesn't (with or without Radzen.Blazor). Events not firing is the reason why the sidebar and panelmenu do nothing.
After spending some more time here is what I found:
This static mode is the default for all Blazor components. This means that events will not fire unless you have @attribute [RenderModeInteractiveServer] or @attribute [RenderModeInteractiveWebAssembly] or even @attribute [RenderModeInteractiveAuto]. No compilation errors or exceptions - it just won't work silently. We can't fix that in any way - this is how .NET 8 Blazor is for now.
You can't easily use @attribute [RenderModeInteractiveServer] or the similar in MainLayout. It will break when you use @Body.
I found a workaround (and also hit another issue).
It is to put the Sidebar and Header in a separate component which has the much needed @attribute [RenderModeServer] and use it in the layout. Find attached a working project.
<RadzenNotification @rendermode="@RenderMode.InteractiveServer" />
<RadzenLayout style="height: 400px">
<Navigation /> <!-- This contains the interactive sidebar and toggle -->
<RadzenBody>
<div class="rz-p-4">
@Body
</div>
</RadzenBody>
<RadzenFooter>
Footer
</RadzenFooter>
</RadzenLayout>
Also note the @rendermode setting of RadzenNotification - it is needed otherwise it won't work
By the way your app was missing two critical things in Program.cs which are required for any interactivity:
This seems to enable the old pre-.NET8 behavior. Also you don't need to change anything in MainLayout.razor - it can stay the same as in .NET7. Of course by doing this you would be losing static rendering mode altogether.
Bonus - here is the explanation of this behavior by the Blazor creator himself.
Thank you very much for your help and support on this one.
I would never have figured it out on my own.
I am starting on a new big project which will take 5-6 months to develop and want to do it with .NET 8 and Blazor, using your components and Radzen Blazor Studio (for UI layout).
Thanks to you I can finally get the UI part underway.
Just to be clear, because these render modes have me in loops...
If I were to add this:
<Routes @rendermode="@RenderMode.Server" />
It would make all of my components / pages whatever use the Server render mode?
But if I were to make a component for the sidebar, mark that with @attribute [RenderModeServer] and leave the Routes component alone, that would allow me to use different render modes on a component to component basis?