.NET MAUI Controls API

Explore the comprehensive API for building native cross-platform applications with .NET MAUI.

Introduction to MAUI Controls

.NET MAUI (Multi-platform App UI) provides a rich set of controls that enable you to build native user interfaces for Windows, macOS, Android, and iOS from a single codebase. These controls are designed to be flexible, extensible, and performant, offering a consistent look and feel across different platforms while allowing for platform-specific customizations.

This section of the API documentation covers the various controls available, their properties, methods, and events, along with usage examples to help you integrate them seamlessly into your applications.

Core Controls

These are the fundamental building blocks for your UI:

Label

Displays text. Supports rich text formatting, multi-line text, and various text styles.

Learn More →

Entry

A single-line text input control. Useful for collecting small amounts of text.

Learn More →

Editor

A multi-line text input control. Ideal for longer text entries like notes or messages.

Learn More →

Button

A tappable control that initiates an action. Can display text or an image.

Learn More →

Image

Displays images from various sources, including local files, URIs, and embedded resources.

Learn More →

CheckBox

A boolean toggle control that allows users to select or deselect an option.

Learn More →

Slider

A control that allows users to select a numeric value within a range.

Learn More →

Switch

A toggle switch control for enabling or disabling a setting.

Learn More →

Layout Controls

Arrange and position your UI elements effectively:

StackLayout

Arranges child elements in a vertical or horizontal stack.

Learn More →

Grid

Arranges child elements in a two-dimensional grid of rows and columns.

Learn More →

FlexLayout

A flexible layout that can arrange elements in multiple directions and wrap them when they exceed available space.

Learn More →

ScrollView

Enables scrolling of content that exceeds the available screen space.

Learn More →

List and Collection Controls

Display and manage collections of data efficiently:

ListView

Displays a scrollable list of items, optimized for performance with large datasets.

Learn More →

CollectionView

A flexible and powerful control for displaying collections of data in various layouts.

Learn More →

CarouselView

Displays a scrollable view of data items, where only one item is visible at a time.

Learn More →

Navigation Controls

Facilitate navigation within your application:

NavigationPage

Manages navigation history and provides a familiar navigation bar experience.

Learn More →

TabbedPage

Presents content in a tabbed interface, allowing users to switch between different views.

Learn More →

FlyoutPage

Implements a master-detail interface, often used for side menus or navigation drawers.

Learn More →

Common API Concepts

Understand the core concepts that apply to most MAUI controls:

Properties

Attributes that define the appearance and behavior of a control. For example, Text, BackgroundColor, IsEnabled.

Learn More →

Methods

Actions that a control can perform. For example, Focus(), InvalidateMeasure().

Learn More →

Events

Notifications that a control sends when something happens, such as user interaction. For example, Clicked, TextChanged.

Learn More →

Data Binding

A powerful mechanism for synchronizing data between your UI and your application's data model.

Learn More →

Example: Using a Button

Here's a simple example of how to use a Button in XAML and C#:

<Button Text="Click Me!" Clicked="OnButtonClicked" />
public partial class MyPage : ContentPage { public MyPage() { InitializeComponent(); } private void OnButtonClicked(object sender, EventArgs e) { // Handle button click event DisplayAlert("Button Clicked", "You tapped the button!", "OK"); } }