Blazor Mobile, Uno Platform, and WebAssembly

栏目: IT技术 · 发布时间: 4年前

On Tuesday, the ever-impressive Blazor team  announced a new experimental project : Mobile Bindings that allow developers to write Blazor-style syntax that produces  Xamarin.Forms  UI controls instead of HTML elements, therefore producing native iOS and Android applications.   

When we at the Uno Platform noticed that they were using Xamarin.Forms, we immediately saw a fun means to validate and stress-test our  Xamarin.Forms renderers for WebAssembly , in order to bring Blazor Native to WebAssembly. Also, a few of you asked about it on Twitter, so we gave it a shot.   

Introducing the Blazor-Xamarin.Forms-UWP-Uno-WebAssembly  uber-stack ! In less than 24hrs we were able to port the ToDo App to WebAssembly

Blazor Mobile, Uno Platform, and WebAssembly

1. Blazor to Xamarin.Forms  

This is the part that the Blazor team announced on Tuesday. Essentially taking a UI defined in Razor syntax (a mix of markup and C# code), processing it, and converting it into a tree of Xamarin.Forms controls.  

2. Xamarin.Forms to UWP  

Although the Blazor team’s announcement highlighted the ability to produce mobile apps for iOS and Android, Xamarin.Forms also supports Windows as a compilation target, using the  UWP framework . The Blazor X.Forms Bindings work perfectly well with UWP.  

In this step, Xamarin.Forms converts its visual tree to a tree of UWP view elements.  

3. UWP (or WinUI) to Uno Platform  

Here’s where Uno comes in. The Uno Platform allows you to build apps for iOS, Android, and the web using C# and XAML. It’s 100% compatible with UWP/WinUI. Uno’s Xamarin.Forms renderers for WebAssembly  allows Xamarin.Forms apps to run in the browser, without any changes.  

4. Uno to WebAssembly  

In the last step, Uno takes the visual tree and produces native HTML, running  natively  in  the browser using  Mono ’s runtime for  WebAssembly  

Blazor Mobile, Uno Platform, and WebAssembly

See it in action  

To test whether this  would work, we used the  TodoApp   sample  released along with the Blazor Mobile Bindings announcement .   Check  out the  fully-functioning web versionhere All the code we used is  up on GitHub  – download it and  run it in Visual Studio  at your leisure !  

Blazor Mobile, Uno Platform, and WebAssembly

Our version is using the exact same Razor components as the original sample, and as you can see it looks very like the Android/iOS version published on ASP.NET Blogs for mobile blazor bindings . There you have it side by side – Blazor mobile bindings running in browser with help from Uno and WebAssembly

Blazor Mobile, Uno Platform, and WebAssembly Blazor Mobile, Uno Platform, and WebAssembly

Public service announcement  

Let’s make one thing clear.  We’re not advising you to run out and use this in production  – after all if you like Blazor syntax and you’re targeting the web,  the original  Blazor has you covered.   

Our motivation was to put our Xamarin.Forms renderer for WebAssembly work to the test, and as far as we are concerned, Uno passed it with flying colors. It just works. We were able to stack all this technology, and reuse the code from the showcased ToDo app in less than a few hours after Mobile Blazor Bindings were announced at the ‘.NET Conf – Focus on Blazor’ virtual conference. We believe this showcases Uno’s versatility and extensibility too.   

In Closing   

We’re serious about this part : if you’re already a Xamarin.Forms developer, and running your existing app on the web without having to rewrite the UI is something that interests you, go ahead and  try out Uno’s Xamarin.Forms renderers for WebAssembly  – adding WebAssembly support to an existing project is as easy as ‘dotnet new wasmxfhead’. Or if you’d like to ask any questions and chat about this tech mash-up –  contact us .


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

鼠标宣言

鼠标宣言

约翰·里德尔 / 倪萍、梅清豪 / 上海人民 / 2005-08-01 / 25.00

本书针对信息时代营销者不知该如何满足消费者的营销困境,提出了崭新的解决方案——以新技术为基础的群体筛选和推荐系统。随着信息管理软件和internet的高速发展,群体筛选技术下的推荐系统通过大量有关消费者偏好和购物记录的信息,以及对产品特征的准确把握,能够为消费者进行精确的推荐,提高了消费者的购物效率和准确度以及营销者的营销效率和竞争力。本书通过通俗而到位的讲解,向读者全面介绍了有关群体筛选技术的理......一起来看看 《鼠标宣言》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

html转js在线工具
html转js在线工具

html转js在线工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试