radzenhq / radzen-blazor-studio

Sample applications created with Radzen Blazor Studio
https://www.radzen.com/blazor-studio
19 stars 4 forks source link

[Feature request] Add support for Blazor Hybrid apps with MAUI #44

Open vgb1993 opened 2 years ago

vgb1993 commented 2 years ago

Is your feature request related to a poblem? Please describe.

As a user of Radzen Studio I would like to create Blazor Hybrid apps with .NET MAUI. Also, I would like to target multiple project types at the same time. Ex: Server & Hybrid.

Describe the solution you'd like

Appart from WebAssebly and Server a third option should be added for Blazor Hybrid apps.

Describe alternatives you've considered

I have not considered any alternatives

Additional context

In my opinion, the components generated by the designer should be located in a .NET library, not in the main project itself. This would make it possible to import the library from multiple aplication types at the same time.

This change would have an interesting side effect: I would be able to import this library in existing projects.

Blazor Hybrid really is a game changer for .NET, this would be a very usefull feature!

akorchev commented 2 years ago

Unfortunately I don't think we could provide first class support for Hybrid as as far as I know it supports native components. Radzen Blazor Studio can only support web stuff in design time. Or maybe I got it wrong? Can you elaborate on this scenario?

vgb1993 commented 2 years ago

Hy there,

Esentially Blazor Hybrid adds a new hosting model for Blazor apps. But it's still Blazor and it's still Web UI. Let's say you have a RazorClassLibrary with some components, pages, styles and other stuff. This library can be hosted with Blazor Wamb, Server and now Hybrid too.

The way Hybrid works is by running the C# code natively in the MAUI app, but the rendering takes place inside a WebView2 component. It's very similar to Blazor Server but instead of running your C# code in the server, it runs on the app and it uses a InterProcessComunicationChanel instead of SignalR. So it's still Web UI, but managed by code running natively on the client.

So the way this could work (I hope) is by geneating the UI code in a libray that is consumed by 3 kind of projects: Server, WASM and MAUI.

This would make it possible to develop UIs using Radzen for native apps. Scince a WebView2 can expand acroos the whole native screen, you would not have to write more than one single native component: The BlazorWebView native component pointing at the RazorClassLibrary. Pretty straight forward stuff, very few lines of native code.

Check out this link for more info: https://devblogs.microsoft.com/dotnet/hybrid-blazor-apps-in-mobile-blazor-bindings-july-update/

akorchev commented 2 years ago

We will check the default dotnet new MAUI templates (if there are any) and see if we can add it as an option.

h5kk commented 11 months ago

We will check the default dotnet new MAUI templates (if there are any) and see if we can add it as an option.

Any updates on this? It should seem fairly simple considering Blazor Web Application, Blazor Server Application, and Blazor WebAssembly Application types are all supported.

Thanks.

akorchev commented 11 months ago

It is on the roadmap. And unfortunately isn't "fairly simple" at all (I wish it were).