Convert Figma logo to code with AI

dotnet logomaui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.

21,980
1,713
21,980
3,762

Top Related Projects

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.

164,677

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

A framework for building native applications using React

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

⚡ Empowering JavaScript with native platform APIs. ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java, Dart). Use what you love ❤️ Angular, Capacitor, Ionic, React, Solid, Svelte, Vue with: iOS (UIKit, SwiftUI), Android (View, Jetpack Compose), Dart (Flutter) and you name it compatible.

Quick Overview

.NET MAUI (Multi-platform App UI) is an open-source framework for building native, cross-platform applications for iOS, Android, macOS, and Windows from a single codebase. It is the evolution of Xamarin.Forms, providing a unified development experience for creating mobile and desktop apps using C# and XAML.

Pros

  • Cross-platform development with a single codebase
  • Native performance and UI on each platform
  • Leverages existing .NET knowledge and ecosystem
  • Supports hot reload for faster development cycles

Cons

  • Steeper learning curve compared to platform-specific development
  • Limited third-party component ecosystem compared to mature platforms
  • Performance may not match fully native apps in some scenarios
  • Debugging can be challenging across multiple platforms

Code Examples

  1. Creating a simple button with an event handler:
Button myButton = new Button
{
    Text = "Click me!",
    HorizontalOptions = LayoutOptions.Center,
    VerticalOptions = LayoutOptions.Center
};

myButton.Clicked += (sender, args) =>
{
    myButton.Text = "Button clicked!";
};
  1. Implementing a basic MVVM pattern:
public class MainViewModel : INotifyPropertyChanged
{
    private string _message;
    public string Message
    {
        get => _message;
        set
        {
            _message = value;
            OnPropertyChanged();
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }
}
  1. Using XAML for UI design:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MyApp.MainPage">
    <StackLayout>
        <Label Text="Welcome to .NET MAUI!"
               VerticalOptions="Center"
               HorizontalOptions="Center" />
    </StackLayout>
</ContentPage>

Getting Started

  1. Install the .NET MAUI workload:

    dotnet workload install maui
    
  2. Create a new .NET MAUI project:

    dotnet new maui -n MyMauiApp
    
  3. Navigate to the project directory and run the app:

    cd MyMauiApp
    dotnet build
    dotnet run
    

This will create and run a basic .NET MAUI application. You can then start adding your own UI components, view models, and business logic to build your cross-platform app.

Competitor Comparisons

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.

Pros of Xamarin.Forms

  • More mature and stable platform with extensive documentation
  • Larger community and ecosystem of third-party libraries
  • Better support for older versions of iOS and Android

Cons of Xamarin.Forms

  • Limited support for desktop platforms (Windows and macOS)
  • Performance can be slower compared to native development
  • Steeper learning curve for developers new to .NET

Code Comparison

Xamarin.Forms:

public class MainPage : ContentPage
{
    public MainPage()
    {
        Content = new StackLayout
        {
            Children = { new Label { Text = "Hello, Xamarin.Forms!" } }
        };
    }
}

MAUI:

public class MainPage : ContentPage
{
    public MainPage()
    {
        Content = new VerticalStackLayout
        {
            Children = { new Label { Text = "Hello, .NET MAUI!" } }
        };
    }
}

The code structure is similar, but MAUI introduces new layout controls like VerticalStackLayout for improved performance and flexibility.

164,677

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

Pros of Flutter

  • Faster development cycle with hot reload feature
  • Larger community and ecosystem, with more third-party packages
  • Better performance for complex UI animations

Cons of Flutter

  • Limited access to native platform features
  • Larger app size due to bundled runtime
  • Steeper learning curve for developers new to Dart

Code Comparison

Flutter:

import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      body: Center(child: Text('Hello, World!')),
    ),
  ));
}

MAUI:

using Microsoft.Maui;
using Microsoft.Maui.Controls;

public class App : Application
{
    public App()
    {
        MainPage = new ContentPage
        {
            Content = new Label { Text = "Hello, World!" }
        };
    }
}

Both frameworks aim to provide cross-platform development capabilities, but they differ in their approach and target audiences. Flutter uses Dart and focuses on creating custom UI components, while MAUI leverages C# and .NET, integrating more closely with native platform controls. Flutter's hot reload feature and extensive widget library make it popular for rapid UI development, whereas MAUI benefits from the mature .NET ecosystem and stronger integration with native platform features.

A framework for building native applications using React

Pros of React Native

  • Larger community and ecosystem, with more third-party libraries and resources
  • Hot reloading for faster development and debugging
  • Single codebase for both iOS and Android platforms

Cons of React Native

  • Performance can be slower than native apps, especially for complex UIs
  • Steeper learning curve for developers not familiar with React
  • Limited access to some platform-specific features

Code Comparison

React Native:

import React from 'react';
import { View, Text } from 'react-native';

const App = () => (
  <View>
    <Text>Hello, World!</Text>
  </View>
);

MAUI:

using Microsoft.Maui.Controls;

public class App : Application
{
    public App()
    {
        MainPage = new ContentPage
        {
            Content = new Label { Text = "Hello, World!" }
        };
    }
}

Summary

React Native and MAUI are both popular frameworks for cross-platform mobile development. React Native offers a larger ecosystem and faster development cycle, while MAUI provides better performance and deeper integration with native platforms. The choice between them depends on factors such as team expertise, project requirements, and target platforms.

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

Pros of Ionic Framework

  • Wider platform support, including web, iOS, Android, and desktop
  • Larger ecosystem with more third-party plugins and components
  • Easier learning curve for web developers familiar with HTML, CSS, and JavaScript

Cons of Ionic Framework

  • Performance may be slower compared to native apps
  • Limited access to native device features without additional plugins
  • Larger app size due to the inclusion of web technologies

Code Comparison

MAUI (C#):

public class MainPage : ContentPage
{
    public MainPage()
    {
        Content = new StackLayout
        {
            Children = { new Label { Text = "Hello, MAUI!" } }
        };
    }
}

Ionic Framework (TypeScript/HTML):

@Component({
  selector: 'app-home',
  template: `<ion-content>
    <h1>Hello, Ionic!</h1>
  </ion-content>`
})
export class HomePage {}

Summary

MAUI and Ionic Framework are both cross-platform development frameworks, but they cater to different developer audiences. MAUI is ideal for .NET developers looking to create native apps, while Ionic Framework is better suited for web developers who want to leverage their existing skills to build hybrid mobile and web applications. The choice between the two depends on the development team's expertise, performance requirements, and target platforms.

⚡ Empowering JavaScript with native platform APIs. ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java, Dart). Use what you love ❤️ Angular, Capacitor, Ionic, React, Solid, Svelte, Vue with: iOS (UIKit, SwiftUI), Android (View, Jetpack Compose), Dart (Flutter) and you name it compatible.

Pros of NativeScript

  • Uses JavaScript or TypeScript, allowing web developers to leverage existing skills
  • Provides direct access to native APIs without plugins
  • Supports a wider range of third-party JavaScript libraries

Cons of NativeScript

  • Smaller community and ecosystem compared to MAUI
  • Less integrated development experience, especially for Visual Studio users
  • May require more platform-specific code for complex UI scenarios

Code Comparison

NativeScript (JavaScript):

import { Application } from '@nativescript/core';

Application.run({ moduleName: 'app-root' });

exports.onNavigatingTo = function(args) {
    const page = args.object;
    page.bindingContext = { message: 'Hello, NativeScript!' };
}

MAUI (C#):

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder.UseMauiApp<App>();
        return builder.Build();
    }
}

Both frameworks aim to provide cross-platform mobile development solutions, but they cater to different developer preferences and skillsets. NativeScript is ideal for JavaScript developers looking for native performance, while MAUI is better suited for .NET developers seeking a more integrated experience within the Microsoft ecosystem.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

.NET Multi-platform App UI (.NET MAUI)

Build Status Build Status

.NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating mobile and desktop apps with C# and XAML. Using .NET MAUI, you can develop apps that can run on Android, iOS, iPadOS, macOS, and Windows from a single shared codebase.

Getting Started

Overview

.NET Multi-platform App UI (.NET MAUI) is the evolution of Xamarin.Forms that expands capabilities beyond mobile Android and iOS into desktop apps for Windows and macOS. With .NET MAUI, you can build apps that perform great for any device that runs Windows, macOS, Android, & iOS from a single codebase. Coupled with Visual Studio productivity tools and emulators, .NET and Visual Studio significantly speed up the development process for building apps that target the widest possible set of devices. Use a single development stack that supports the best of breed solutions for all modern workloads with a unified SDK, base class libraries, and toolchain. Read More

.NET MAUI Weather App on all platforms

Current News

Follow the .NET MAUI Blog and visit the News wiki page for more news and updates.

FAQs

Do you have questions? Do not worry, we have prepared a complete FAQ answering the most common questions.

How to Engage, Contribute, and Give Feedback

Some of the best ways to contribute are to try things out, file issues, join in design conversations, and make pull-requests. Proposals for changes specific to MAUI can be found here for discussion.

See CONTRIBUTING, CODE-OF-CONDUCT and the Development Guide.