...

/

XAML MAUI Composite and Container View Types

XAML MAUI Composite and Container View Types

Learn about multipart or special view types supported by the .NET MAUI version of XAML.

As well as supporting basic single-functionality controls, .NET MAUI supports more complex views. Some are used for rendering a collection of items. Some are used for drawing arbitrary shapes. Some are used as containers for other items. Some allow us to create our own custom controls.

In this lesson, we'll cover two view categories: collection views and container views. To demonstrate more advanced view types supported by the .NET MAUI version of XAML, we'll look at the following project setup.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#512BD4</color>
    <color name="colorPrimaryDark">#2B0B98</color>
    <color name="colorAccent">#2B0B98</color>
</resources>
MAUI app with composite views demonstrated

Composite controls

Now we'll look at XAML controls that have been designed to work with collections of values. Each of these controls contains and interacts with multiple data points rather than just a single value.

RadioButton

This control allows us to choose a single value from a collection of values. When one value is selected, all other values become unselected. Multiple RadioButton elements are typically contained within a StackLayout element, as per the following ...