DEV Community

Cover image for .NET MAUI is HERE! 3 NEW Features that will blow your mind 🤯
ByteHide
ByteHide

Posted on • Updated on

.NET MAUI is HERE! 3 NEW Features that will blow your mind 🤯

.NET MAUI is a framework for .NET Core and ASP.NET Core MVC applications which can be used in cross-platform development and in building complex web applications.

.NET MAUI was created by Microsoft to take care of all the things that developers usually need to do themselves, such as managing HTTP requests, setting up routing logic, handling errors and more. So that they can focus on what’s important: building an application that does something useful for their customers.

In the latest preview, Microsoft showed three new features about .NET MAUI that will blow your mind 👇


✨Updated Controls

Microsoft has changed the implementations of numerous controls in this new .NET MAUI version, which is a significant improvement. Let’s look at the most important ones.

📦 BoxView

BoxView is a basic rectangle with a given width, height, and color. It could be used for BoxView decorating, basic graphics, and touch interaction with the user.

BoxView (By. Microsoft)

📐IndicatorView

The IndicatorView is a control that shows indications in a CarrouselView that reflect the number of items and the current position:

IndicatorView control (By. Microsoft)

📷 ImageButton

The ImageButton view has the ability to combine the Button and Image views to produce a button with an image as its content. To command the program to do a certain activity, the user pushes the ImageButton with their finger or clicks it with their mouse. The ImageButton view, unlike the Button view, has no idea of text and text appearance.

ImageButton (By. Microsoft)

💻 WebView

WebView renders any online or embedded HTML material using the platform’s native browser control; suitable for displaying markup that is more complicated than the subset of HTML supported by Label.

New .NET MAUI WebView (By. Microsoft)


🔲 Shadows, corners, and borders

Here we have Microsoft.Maui.Graphics library, that offers an +uniform UI* drawing API based on native graphics engines, allowing us to quickly add borders, corner rendering, and gorgeous shadows to nearly any .NET MAUI layout or control.

Corners and borders in .NET MAUI (By. Microsoft)

Microsoft presents a new Border control. It can be wrapped around any layout or control to offer borders and independent corner control. This controls are available in WPF, UWP, Silverlight, and the most recent Windows App SDK styles.

In this Microsoft example, we can see how they added the stroke and rounded the top-left and bottom-right corners by wrapping a border checks around the counter label this template 👇

<Border 
    Grid.Row="2"
    Padding="16,8"
    Stroke="{StaticResource PrimaryBrush}"
    Background="#2B0B98"
    StrokeThickness="4"
    HorizontalOptions="Center">
    <Border.StrokeShape>
        <RoundRectangle CornerRadius="40,0,0,40"/>
    </Border.StrokeShape>
    <Label 
        Text=".NET MAUI Preview: 9"                
        FontSize="18"
        FontAttributes="Bold"
        TextColor="White"
        x:Name="CounterLabel" />
</Border>
Enter fullscreen mode Exit fullscreen mode

The specified shape’s corner radius accepts a Thickness type value, allowing separate control of each of the rectangle’s +four corners:* bottom-left, bottom-right, top-left and top-right.

The border control creates a wraparound view element around a single piece of content, allowing you to customize the background color and padding. There are several more attributes that may be used to modify the border’s stroke, including:

  • StrokeLineCap: is a form that appears at the end of a line.

  • StrokeDashOffset: is the distance between the dots in the dash pattern.

  • StrokeMiterLimit: set the miter length ratio to half of the stroke thickness.

  • StrokeLineJoin: a type of vertices join.

  • StrokeDashArray: a dash and gap pattern in the stroke.

Are you ready to give your user interface some depth? Any layout or control, including pictures and objects, can be given with Shadow 👇

<Image>
    <Image.Shadow>
        <Shadow Brush="#000000" 
                Offset="20,20"
                Radius="40"
                Opacity="0.8"/>
    </Image.Shadow>
</Image>
Enter fullscreen mode Exit fullscreen mode

This is the result 👇

Shadows in .NET MAUI (By. Microsoft)


🚄 Android Quick Start

Ahead-of-time (AOT) compilation improves the speed with which your Android applications can code start. If you’re trying to stay below the wifi installation bar, full AOT may make your application artifacts larger than you want.

Startup tracing is the solution in this case. We may balance performance and space by partially AOT’ing only the sections of your program that are run at startup.

The following are the results of device testing on the Pixel 5:

Microsoft Benchmark on Pixel 5 (By. Dotnetsafer)


🔰 Ecosystem Controls

DevExpress, Syncfusion, and Telerik have all recently released new sets of controls for.NET MAUI that take use of Microsoft’s strong graphics capabilities. Maui.Graphics.

Ecosystem Controls (By. Microsoft)

Top comments (5)

Collapse
 
zaichengpao profile image
zaichengpao

Why is .NET MAUI better than Xamarin?

Collapse
 
mscnewscntnt profile image
mscnewscntnt

With.NET 5, Microsoft begins the process of unifying the.NET platform by combining.NET Core and Mono/Xamarin into a single base class library (BCL) and toolchain (SDK), which you can read more about here.

.NET MAUI is a term for a new updated solution as a Multi-platform App UI framework for developing native cross-platform apps with.NET for Android, iOS, macOS, and Windows, as everyone well knows. It's the next step in Xamarin's development. Built on top of it, Forms has been and continues to be a new flagship.NET solution for developing native cross-platform programs.

Personally, I think it's fantastic that the.NET team will devote additional resources to developing this framework, which currently has a fantastic Xamarin component. In the last year or two, the Forms team has made a significant impact and enhancement to the platform.

For the time being, the GitHub repository (July 2020) is nearly identical to the XF one, with all namespaces being System.

Maui, but things will be drastically different in the future. As they stated on keynote and other platforms:

  • One project for a variety of platforms and devices
  • Fonts and pictures may all be managed in one place.
  • To arrange your platform-specific code, use multi-targeting.

It will also assist you in developing apps using a variety of contemporary patterns and frameworks, such as:

To design and develop apps with.NET MAUI, use the MVVM MVU RxUI tools:

  • Visual Studio is a program that allows you to create
  • Visual Studio for Mac is a software application that allows you to create visual
  • Visual Studio Code is a graphical programming environment.
Collapse
 
zaichengpao profile image
zaichengpao

Wow, incredible response♥♥

Thread Thread
 
zaichengpao profile image
zaichengpao

Okay, but... To migrate from Xamarin to Maui? I mean, is it possible? Is there any way? Has Microsoft said anything?

Thread Thread
 
mscnewscntnt profile image
mscnewscntnt

Yes, Microsoft has mentioned it. The best part is that you won't have to change your Xamarin code. To migrate Forms apps to the.NET Multi-platform App UI, go here (.NET MAUI).

Each application, however, will require a minor amount of code modifications. Similarly, you may use a single project's functionality without merging all Xamarin projects. Combines many projects into a single project.

You can check Microsoft's official response in case you are in doubt: docs.microsoft.com/en-us/dotnet/ma...