Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Net how to realize cross-platform application MAUI

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces ".NET how to achieve cross-platform application MAUI". In daily operation, I believe many people have doubts about how .NET implements cross-platform application MAUI. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about ".NET how to achieve cross-platform application MAUI". Next, please follow the editor to study!

MAUI overview

What is the .NET MAUI?

The .NET MAUI, an evolution of the increasingly popular Xamarin.Forms toolkit, turns 6 this month. For years, companies such as UPS, Ernst & Young and Delta have been using Xamarin's mobile expertise to power their businesses on .NET; some from the beginning. It has also been very successful, helping small businesses maximize their development investment to share more than 95% of their code and beat competitors to market. The .NET MAUI extends this success on mobile devices to embrace the desktop as the best way to build multi-platform applications between the two, especially new devices such as the new Surface Duo.

The .NET MAUI simplifies the choice of .NET developers, providing a single stack that supports all modern workloads: Android, iOS, macOS, and Windows. In a simple cross-platform API, the native functionality of each platform and UI control is within reach, allowing you to provide a real user experience while sharing more code than ever before.

Individual project developer experience

The .NET MAUI is built with the productivity of developers in mind, including the project systems and cross-platform tools that developers need. The .NET MAUI simplifies the project structure to a single project to locate multiple platforms. This means that with a single click, you can easily deploy to any target, including desktops, simulators, simulators, or physical devices. With built-in cross-platform resources, you will be able to add any image, font, or translation file to a single project, and .NET MAUI will automatically set native hooks so that you can encode. Finally, you always have access to the native base operating system API, and it will be easier than ever to use the new platform-specific integration. Under the platform, you can add source code files for specific operating systems and access native API. With the .NET MAUI, everything is in one place, and you need it to stay productive.

.NET MAUI Single Project

This provides:

A project for multiple platforms and devices

A place to manage resources, such as fonts and images

Multi-target organization platform-specific code

You have a way to build client applications, the MAUI way, and all platforms are within your reach. Today, Scott Hanselman and I will demonstrate it in action in the construction, journey of a .NET.

Modern application mode

Part of a .NET vision is to provide developer choices in areas of personal preference, so you can use .NET most effectively. In IDE, whether it's Visual Studio 2019, Mac's visualization studio, or even visual studio code, you use IDE. The .NET MAUI will be available in all of these modes and will support existing MVVM and XAML schemas, as well as future features such as model view updates using C # (MVU), and even Blazor.

MVVM

Model View-View Model (MVVM) and XAML are the main patterns and practices of .NET developers for decades and are best-in-class features in the .NET MAUI. This will continue to evolve to help you build and maintain production applications efficiently.

Public Command ClickCommand {get;} public string Text {get; set;} = "Click me"; int count = 0 count void ExecuteClickCommand () {count++; Text = $"You clicked {void} void.";} MVU

In addition, we enable developers to write fluent C # UI and implement the increasingly popular Model View Update (MVU) pattern. MVU facilitates an one-way flow of data and state management, as well as a code-first development experience, and UI can be updated quickly by applying the necessary changes. For more information about MVU as a schema, see this Elm programming guide and Thomas Bent's blog.

The following is a basic counterexample in the MVU style written in .NET MAUI.

Readonly State count = 0; [Body] View body () = > new StackLayout {new Label ("Welcome to .NET MAUI!"), new Button () = > $"You clicked {count} times.", () = > count.Value + +)}

This mode is ideal for hot reloading, because below you can see the added styles, gradients, and fonts, which are reloaded with the instant hot reload of C#.

MAUI model-view-update

Both MVVM and MVU provide the same native applications, performance, and platform fidelity. Developers will be able to choose the style that best suits their preferences and use cases.

Convert from Xamarin.Forms to .NET MAUI

Xamarin.Forms developers will run with the new project in the .NET MAUI, using all the same controls and API they have grown into and love. As we get closer and closer to the release of the .NET MAUI, to help developers make a smooth transition of existing applications to the .NET MAUI, we intend to provide support and migration guidelines for trying to convert, similar to the support and migration guidelines we did today when we migrated to the .NET Core.

.net MAUI Timeline

We will start shipping a preview version of the .NET MAUI later this year, with versatility targeting .NET 6 in November 2021. .net MAUI will ship at the same 6-week pace Xamarin.Forms has been opened. We have posted the MAUI roadmap on GitHub and invite you to join us now!

The next step of Xamarin and Xamarin.

As part of the .NET unification, Xamarin.iOS and Xamarin.Android will be part of .NET 6, as .NET for iOS and .NET for Android. Because these bindings are projections of SDK shipped from Apple and Google, there will be no change, so the build tool, target framework name, and runtime framework name will be updated to match all other .NET 6 workloads. We are committed to keeping .NET developers informed of the latest mobile SDK, which is the foundation of the .NET MAUI and is still firmly bad. When .NET 6 ships, we expect to finally release Xamarin Sdk in its current form for one year of service. At that time, all modern works will be transferred to .NET 6.

Xamarin.Forms will release a new major version later this year, and will continue to release small and service versions every six weeks through the .NET 6 GA in November 2021. The final version of Xamarin.Forms will be available within one year after shipment, and all modern work will be transferred to the .NET MAUI.

At this point, the study on ".NET how to implement cross-platform application MAUI" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report