2

.NET MAUI Preview 5: Animations, Ported UI Components and Single Project Templat...

 3 years ago
source link: https://www.infoq.com/news/2021/06/dotnet-maui-preview-5/?utm_campaign=infoq_content&utm_term=global
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

.NET MAUI Preview 5: Animations, Ported UI Components and Single Project Templates Updates

Jun 28, 2021 2 min read

One month after Microsoft Build and Preview 4, the .NET MAUI team continued the progress with .NET Multi-platform App UI, and Preview 5 is in front of us. It brings animations and the view transformation support, a couple of ported UI Components from the renderer architecture of Xamarin.Forms, and Single Project Templates updates and improvements. 

Also, as part of this release, the preview version of documentation for introductory and foundational aspects of .NET MAUI is also available for exploration.

In this release several controls now have all properties and events ported to handlers from the renderer architecture of Xamarin.Forms, including ActivityIndicator, CheckBox, Image, and Stepper. In previous previews you would need to check if a control was ported and register renderers from the compatibility package for those unavailable. In .NET MAUI Preview 5 we have made this much easier by updating the UseMauiApp extension (see the Startup wiki [URL: https://github.com/dotnet/maui/wiki/Application-Startup]) to wire up all the controls for you, whether they are based on handlers or renderers, stated David Ortinau, principal program manager, .NET Multi-platform App UI.

Well-known, the Shell, an application container that provides URI navigation and a quick way to implement flyout menus and tabs is now available in .NET MAUI with Preview 5 version. The official dev blog article provides a simple example of usage within the App.xaml.cs.

protected override IWindow CreateWindow(IActivationState activationState)
{
    return new Microsoft.Maui.Controls.Window(
        new AppShell()
    );
}
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui" 
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:pages="clr-namespace:ControlGallery.Pages"
       Title="ControlGallery"
       x:Class="ControlGallery.AppShell">

    <FlyoutItem Title="Margin and Padding">
        <ShellContent Route="marginpadding" 
                      ContentTemplate="{DataTemplate pages:ControlsPage}" />
    </FlyoutItem>

    <FlyoutItem Title="ActivityIndicator">
        <ShellContent Route="activityindicator" 
                      ContentTemplate="{DataTemplate pages:ActivityIndicatorPage}" />
    </FlyoutItem>

    ...

</Shell>

An overview of the latest information about controls, layouts, and other features can be found on the .NET MAUI status page.

There are a couple of ways to perform animation in .NET MAUI; the easy way is with extension methods such as FadeTo, RotateTo, ScaleTo, TranslateTo, and more. In the official dev blog, David Ortinau provided a sample of using them with HandlerAttached event. The sample source code can be found on the WeatherTwentyOne project on GitHub.

Regarding the Single Project Templates updates, Preview 5 also introduced some of the progress which was made consolidating the multiple WinUI projects into one. Now, the usage of dotnet new maui the command will produce the solution with two projects, one multi-targeted .NET MAUI and the WinUI project.

As stated: “This is one step closer to the final vision of having just one project that can build and deploy to all supported platforms. In order to support this, you’ll need to install these Project Reunion 0.8 (Preview) extensions for Visual Studio 16.11 Preview 2.”

To follow the project development progress and next releases of .NET MAUI, the official roadmap is available on the GitHub wiki roadmap.

We need your feedback

How might we improve InfoQ for you

Thank you for being an InfoQ reader.

Each year, we seek feedback from our readers to help us improve InfoQ. Would you mind spending 2 minutes to share your feedback in our short survey? Your feedback will directly help us continually evolve how we support you.

Take the Survey


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK