MAUI API Reference

Explore the comprehensive Application Programming Interface (API) for .NET MAUI, enabling you to build cross-platform applications with a single codebase.

MAUI Controls

Access and utilize the rich set of pre-built UI controls for crafting your application's user interface.

Microsoft.Maui.Controls.Button

Button Class

Represents a button control that can be clicked by the user.

Properties

  • string Text: Gets or sets the text displayed on the button.
  • Brush Background: Gets or sets the background brush of the button.
  • Color TextColor: Gets or sets the color of the button's text.

Methods

void SendClickedSignal()
Triggers the Clicked event.

Events

EventHandler Clicked
Occurs when the button is clicked.

Example

var myButton = new Button
{
    Text = "Click Me",
    TextColor = Colors.White,
    Background = Brush.Blue
};

myButton.Clicked += (sender, e) => {
    Console.WriteLine("Button clicked!");
};
Microsoft.Maui.Controls.Entry

Entry Class

Represents a control that allows the user to edit single lines of text.

Properties

  • string Text: Gets or sets the text currently in the entry.
  • Color PlaceholderColor: Gets or sets the color of the placeholder text.
  • string Placeholder: Gets or sets the text displayed when the entry is empty.

Events

EventHandler TextChanged
Occurs when the text in the entry changes.

Microsoft.Maui.Controls.Label

Label Class

A control that displays a short string of text.

Properties

  • string Text: Gets or sets the text to be displayed.
  • FontAttributes FontAttributes: Gets or sets the font attributes.
  • double FontSize: Gets or sets the font size.

MAUI Essentials

Leverage .NET MAUI Essentials to access native device features like network connectivity, sensors, and device information.

Microsoft.Maui.Essentials.Connectivity

Connectivity Class

Provides APIs to check and monitor network connectivity.

Methods

NetworkAccess NetworkAccess
Gets the current network access state.

event EventHandler ConnectivityChanged
Raised when the network connectivity changes.

Microsoft.Maui.Essentials.DeviceInfo

DeviceInfo Class

Provides information about the device the app is running on.

Properties

  • string Model: Gets the device model.
  • string Manufacturer: Gets the device manufacturer.
  • Idiom Idiom: Gets the device idiom.

MAUI Graphics

Utilize the graphics APIs for drawing shapes, lines, and images.

Microsoft.Maui.Graphics.Canvas

Canvas Class

Provides methods for drawing on a canvas.

Methods

void DrawRectangle(float x, float y, float width, float height)
Draws a rectangle.

void FillCircle(float x, float y, float radius)
Fills a circle.

MAUI Layouts

Arrange UI elements on the screen using various layout containers.

Microsoft.Maui.Controls.StackLayout

StackLayout Class

Arranges child elements in a linear stack, either horizontally or vertically.

Properties

  • StackOrientation Orientation: Gets or sets the orientation of the stack.
  • double Spacing: Gets or sets the spacing between child elements.
Microsoft.Maui.Controls.Grid

Grid Class

Arranges child elements in a table-like structure of rows and columns.

Properties

  • ColumnDefinitions ColumnDefinitions: Gets the collection of column definitions.
  • RowDefinitions RowDefinitions: Gets the collection of row definitions.

MAUI Pages

Build the structure of your application screens with different page types.

Microsoft.Maui.Controls.ContentPage

ContentPage Class

A page that displays a single view.

Properties

  • View Content: Gets or sets the view to be displayed on the page.
Microsoft.Maui.Controls.FlyoutPage

FlyoutPage Class

A page that presents a root page (detail) and a flyout menu (master).

Properties

  • Page Detail: Gets or sets the detail page.
  • Page Flyout: Gets or sets the flyout page.

Platform Specifics

Access platform-specific APIs and customizations when needed.

Microsoft.Maui.PlatformSpecific.WindowsSpecificExtensions

WindowsSpecificExtensions Class

Provides extension methods for Windows-specific UI elements.

Methods

void SetTitleBarColor(this Page page, Color color)
Sets the color of the Windows title bar.

App Model

Understand the core components for managing your .NET MAUI application lifecycle.

Microsoft.Maui.MauiApp

MauiApp Class

The entry point for .NET MAUI applications.

Methods

static MauiAppBuilder CreateBuilder()
Creates a new builder for the MAUI application.