Hi, I believe this issue may be related to a rendering problem.
When I create a default Blazor project using .NET 8 with interactivity set per page/component, and I add the following line to the MainLayout: <RadzenComponents @rendermode="InteractiveAuto" />
I noticed that if any child components rendered within this layout use a different InteractiveRenderMode, such as WebAssembly, then Radzen services (e.g., DialogService) stop working properly.
Here’s a simple scenario to illustrate the issue:
The RadzenComponents are rendered in the layout.
A child component of the layout uses @rendermode="InteractiveWebAssembly".
In the app try to use the dialog service, it only works in one render mode(the mode specified in SomeComponent in the 4step)
Expected Behavior: Radzen services should function normally regardless of the render mode used by a descendent of the the main layout.
Actual Behavior: Radzen services stop working when the child component uses a different InteractiveRenderMode (e.g., InteractiveWebAssembly) than the one used in the layout
No. You need to either specify explicitly or inherit interactive render mode or no Blazor event will work no matter in Radzen components or plain Blazor/HTML components.
No. I said that services (DialogService, NotificationService etc.) don't work when mixed rendering modes are used. Radzen Blazor components support Blazor web apps and saying otherwise is just wrong.
We've just created a GitHub repository with an example that allows you to reproduce the problem we mentioned:
In the example, in the MainLayout.razor.cs file, we've added the RadzenComponents component twice, one for each rendering mode (InteractiveServer and InteractiveWebAssembly). This way, the application works correctly.
If only one of them is added, the RadzenDialog component will only work on pages with the same rendering mode. Furthermore, if it's added with the InteractiveAuto rendering mode, it will only work with the rendering mode used by the first page displayed.
Shouldn't it be possible to use Radzen components with different rendering modes within the application? If this is possible, is it correct to duplicate the RadzenComponents component in the MainLayout.razor.cs file as we did in the example? Should the configuration be done differently?
Unfortunately I don't think this is possible. Those components (dialog, notification, tooltip and others) rely on a service. When you use mixed rendering modes that service is probably not the same instance hence <RadzenDialog /> never gets notified that you want to open it. Feel free to trace the source code in order to verify.
If it works why not? Just make sure you don't end up with two instances of the same dialog open.