.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
Application
class.
Properties
-
bool Application.IsLaunched
Gets a value indicating whether the application has been launched.
-
IReadOnlyList<IWindow> Application.Windows
Gets 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.Page
Gets or sets the root page of the window.
-
string IWindow.Title
Gets 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.HeightRequest
Gets or sets the desired height of the view.
-
double View.WidthRequest
Gets or sets the desired width of the view.
-
Thickness View.Margin
Gets 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.Text
Gets or sets the text content of the label.
-
Color Label.TextColor
Gets or sets the color of the text.
-
TextDecorations Label.TextDecorations
Gets 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.R
Gets the red component of the color.
-
float Color.G
Gets the green component of the color.
-
float Color.B
Gets the blue component of the color.
-
float Color.A
Gets the alpha (opacity) component of the color.
Static Properties
-
Color Color.AliceBlue
Represents the color AliceBlue.
-
Color Color.Black
Represents the color Black.
-
Color Color.White
Represents the color White.
-
Color Color.Red
Represents the color Red.
-
Color Color.Blue
Represents the color Blue.
-
Color Color.Green
Represents 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").