.NET MAUI API Reference
Welcome to the .NET MAUI API documentation. Explore the namespaces and types that power your cross-platform applications.
Namespace: Microsoft.Maui
Class: Application
Represents a .NET MAUI application.
The Application class is the entry point for a .NET MAUI application. It provides access to application-level resources, lifecycle events, and the main window.
Constructors
-
Application()Initializes a new instance of the
Applicationclass.
Properties
-
bool Application.IsLaunchedGets a value indicating whether the application has been launched.
-
IReadOnlyList<IWindow> Application.WindowsGets the collection of windows associated with this application.
Methods
-
void Application.OnAppearing()Called when the application appears. Override this method to add your application's initialization code.
-
void Application.OnBackgrounding()Called when the application is backgrounded.
-
void Application.OnLaunching(IWindow window)Called when the application is launched. Override this method to provide the initial UI.
-
void Application.OnResuming()Called when the application is resumed from the background.
-
void Application.OnStateChanged(ApplicationState newState)Called when the application's state changes.
-
void Application.OnStopping()Called when the application is stopping.
Namespace: Microsoft.Maui
Interface: IWindow
Represents a window in a .NET MAUI application.
The IWindow interface defines the contract for a window, which is a top-level container for the application's UI.
Properties
-
Page IWindow.PageGets or sets the root page of the window.
-
string IWindow.TitleGets or sets the title of the window.
Namespace: Microsoft.Maui.Controls
Class: View
Represents a UI element that can be displayed on the screen.
View is the base class for all visual elements in .NET MAUI. It provides properties and methods for layout, input handling, and visual appearance.
Properties
-
double View.HeightRequestGets or sets the desired height of the view.
-
double View.WidthRequestGets or sets the desired width of the view.
-
Thickness View.MarginGets or sets the margin of the view.
Methods
-
void View.InvalidateMeasure()Invalidates the layout of the view, forcing a re-measurement and re-layout.
Namespace: Microsoft.Maui.Controls
Class: Label
Represents a control that displays a block of text.
Label is used to display static or dynamic text content within your application.
Properties
-
string Label.TextGets or sets the text content of the label.
-
Color Label.TextColorGets or sets the color of the text.
-
TextDecorations Label.TextDecorationsGets or sets the text decorations.
Namespace: Microsoft.Maui.Graphics
Struct: Color
Represents an RGBA color.
The Color struct is used to define colors with Red, Green, Blue, and Alpha components.
Properties
-
float Color.RGets the red component of the color.
-
float Color.GGets the green component of the color.
-
float Color.BGets the blue component of the color.
-
float Color.AGets the alpha (opacity) component of the color.
Static Properties
-
Color Color.AliceBlueRepresents the color AliceBlue.
-
Color Color.BlackRepresents the color Black.
-
Color Color.WhiteRepresents the color White.
-
Color Color.RedRepresents the color Red.
-
Color Color.BlueRepresents the color Blue.
-
Color Color.GreenRepresents the color Green.
Methods
-
Color Color.FromArgb(int argb)Creates a Color from an ARGB integer.
-
Color Color.FromHex(string hex)Creates a Color from a hexadecimal string (e.g., "#RRGGBB" or "#AARRGGBB").