Build Your First .NET MAUI App

.NET MAUI lets you build native applications for multiple platforms from a shared C# codebase. This guide walks through the basic workflow for creating a first application and understanding the files you will work with most often.

🚀 Try this example in the MAUI Playground

1. Create the Project

In Visual Studio, create a new project and select .NET MAUI App. Choose a project name and target the current .NET version installed on your machine.

After the project is created, Visual Studio provides the platform targets, shared application code, XAML resources, and configuration files required by the template.

2. Understand the Project Structure

3. Build a Simple UI

A MAUI page can be created with XAML controls such as VerticalStackLayout, Label, Entry, and Button.

<VerticalStackLayout Padding="30" Spacing="15">
    <Label Text="Hello, MAUI!" FontSize="28" />
    <Entry Placeholder="Enter your name" x:Name="NameEntry" />
    <Button Text="Say Hello" Clicked="OnSayHelloClicked" />
</VerticalStackLayout>

The page's code-behind can respond to the button event and update the interface.

private void OnSayHelloClicked(object sender, EventArgs e)
{
    DisplayAlert("Welcome", $"Hello, {NameEntry.Text}!", "OK");
}

4. Run the Application

Select a supported target such as Windows or an Android emulator and start debugging. The same shared page can be used across supported platforms while platform-specific behavior remains available when required.

5. Where to Go Next

Once the first application runs, the next useful topics are dependency injection, MVVM, navigation, local storage, REST API calls, Blazor Hybrid, and platform-specific APIs.

See the .NET MAUI Tutorials hub for the broader learning roadmap.

Common Beginner Mistakes

Conclusion

Your first .NET MAUI application is mainly about understanding the shared project structure and the relationship between XAML, C#, resources, and platform-specific code. From this foundation, you can progressively introduce MVVM, dependency injection, APIs, databases, and Blazor Hybrid.

đŸ’Ŧ Comments

Sign in with Google to publish immediately, or comment anonymously and wait for approval.

Comments will appear here when available.