Introduction to .NET MAUI Controls
.NET Multi-platform App UI (.NET MAUI) provides a rich set of controls for building modern, cross-platform applications with C# and XAML. These controls are designed to be highly flexible and customizable, enabling you to create consistent user experiences across Windows, macOS, Android, and iOS.
Basic Controls
These are the fundamental building blocks for your UI.
Button
Represents a button that triggers an action when tapped.
Properties: Text, Command, BackgroundColor, TextColor
<Button Text="Click Me" Command="{Binding MyCommand}" />
Label
Displays text, which can be formatted in various ways.
Properties: Text, FontSize, FontAttributes, TextColor
<Label Text="Welcome to MAUI!" FontSize="24" TextColor="Blue" />
Image
Displays images from local resources, URIs, or embedded resources.
Properties: Source, Aspect
<Image Source="my_image.png" Aspect="AspectFill" />
Text Controls
For handling and displaying textual content.
Entry
A single-line text input control.
Properties: Text, Placeholder, IsPassword
<Entry Placeholder="Enter your name" />
Editor
A multi-line text input control.
Properties: Text, Placeholder, MaxLength
<Editor Placeholder="Enter your message..." HeightRequest="150" />
Input Controls
Allow users to interact and provide input.
Slider
Allows users to select a value from a specified range.
Properties: Minimum, Maximum, Value
<Slider Minimum="0" Maximum="100" Value="50" />
Switch
A toggle switch for boolean values.
Properties: IsToggled, OnColor, ThumbColor
<Switch IsToggled="true" />
Display Controls
For presenting information to the user.
ActivityIndicator
Indicates that a process is ongoing.
Properties: IsRunning, Color
<ActivityIndicator IsRunning="true" Color="Green" />
Selection Controls
Enable users to make choices.
CheckBox
A control that can be checked or unchecked.
Properties: IsChecked, Text
<CheckBox IsChecked="false" Content="Remember Me" />
RadioButton
Selects one option from a group of options.
Properties: Content, GroupName, IsChecked
<RadioButton Content="Option 1" GroupName="MyOptions" IsChecked="true" />
Navigation Controls
Help users navigate through the application.
TabbedPage
Organizes content into tabs at the top or bottom of the screen.
Properties: Children (list of pages)
<TabbedPage>
<ContentPage Title="Tab 1" />
<ContentPage Title="Tab 2" />
</TabbedPage>
Collection Controls
Used to display lists and grids of data.
CollectionView
A flexible way to present lists of data.
Properties: ItemsSource, ItemTemplate
<CollectionView ItemsSource="{Binding Items}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Label Text="{Binding}" />
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
ListView
A traditional list control for displaying scrollable lists of data.
Properties: ItemsSource, ItemTemplate
<ListView ItemsSource="{Binding Data}">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Name}" Detail="{Binding Description}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Image Controls
Specialized controls for image handling.
ImageButton
A button that displays an image and triggers an action.
Properties: Source, Command, Aspect
<ImageButton Source="refresh_icon.png" Command="{Binding RefreshCommand}" />
Media Controls
For integrating media playback.
WebView
Displays web content within your application.
Properties: Source
<WebView Source="https://docs.microsoft.com/dotnet/maui" />
This is a selection of the most common controls. For a complete list and detailed API documentation, please refer to the official .NET MAUI documentation.