.razor page has HTML tags and
@code with C# instructions.
Would Blazor Mobile Binding be also like XAML tags and C# code in the following?
I find the Blazor Mobile app samples are using
BlazorWebView with HTML
So basically if I don’t want to use
BlazorWebView or don’t want a hybrid app, can I only use XAML and C# code in the same
.razor file to make a native app?
Previously, on Xamarin platform, we write XAML and C# as code-behind language in a separate
There is two ways to work with Blazor in .NET MAUI as you have already discovered.
Blazor Mobile Bindings
The Blazor Mobile Bindings allow you to, indeed, mix XAML and code now. In effect this brings the Blazor programming model to .NET MAUI, but besides that has nothing to do with actual Blazor as you know it today in terms of rendering. It will still renderer to native controls on each platform just like when you use XAML or C# to build Xamarin.Forms apps today. But you can now do it in razor files and mix code with markup.
Also a new control has been introduced:
BlazorWebView. With this control you can load an existing Blazor application (HTML + code in razor files).
Having all that said, the cool thing is to realize that
BlazorWebView is one of the controls you can use together with Blazor Mobile Bindings. So effectively you can make a crazy mix between XAML and code as well as HTML and code. If that is something you should want, that’s up to you, but it’s possible!
The Blazor Mobile Bindings can be used with Xamarin.Forms today and, at the time of writing, are still in an experimental state. Read more about the potential future here.
Answered By – Gerald Versluis