New to Telerik UI for .NET MAUI? Start a free 30-day trial

.NET MAUI Expander Getting Started

This article will guide you through the steps needed to add a basic RadExpander control in your application.

At the end, you will be able to achieve the following result.

Expander Getting Started

Prerequisites

Before adding the BadgeView, you need to:

  1. Set up your .NET MAUI application.

  2. Download Telerik UI for .NET MAUI.

  3. Install Telerik UI for .NET MAUI.

Define the Control

The snippet below shows a simple RadExpander definition in XAML:

<telerik:RadExpander x:Name="expander" HeaderText="More Options">
    <telerik:RadExpander.Content>
        <VerticalStackLayout Margin="5">
            <HorizontalStackLayout Spacing="10">
                <telerik:RadCheckBox VerticalOptions="Center"/>
                <Label Text="Make my profile private" 
                       HeightRequest="60" 
                       VerticalTextAlignment="Center"/>
            </HorizontalStackLayout>
            <HorizontalStackLayout Spacing="10" >
                <telerik:RadCheckBox VerticalOptions="Center" />
                <Label Text="Only show my posts to people who follow me" 
                       HeightRequest="60" 
                       VerticalTextAlignment="Center"/>
            </HorizontalStackLayout>
        </VerticalStackLayout>
    </telerik:RadExpander.Content>
</telerik:RadExpander>

In order to use the control in XAML, you need to add the following namespace:

xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"

The snippet below shows a simple RadExpander definition in C#:

var mainStack = new VerticalStackLayout { Margin = new Thickness(10) };
var expander = new RadExpander { HeaderText = "More Options" };

var stackContainer = new VerticalStackLayout { Margin = new Thickness(5) };
var firstCheckboxStack = new HorizontalStackLayout { Spacing = 10 };
firstCheckboxStack.Children.Add(new RadCheckBox() { VerticalOptions = LayoutOptions.Center });
firstCheckboxStack.Children.Add(new Label { Text = "Make my profile private", HeightRequest = 60, VerticalTextAlignment = TextAlignment.Center });
stackContainer.Children.Add(firstCheckboxStack);

var secondCheckboxStack = new HorizontalStackLayout { Spacing = 10 };
secondCheckboxStack.Children.Add(new RadCheckBox() { VerticalOptions = LayoutOptions.Center });
secondCheckboxStack.Children.Add(new Label { Text = "Only show my posts to people who follow me", HeightRequest = 60, VerticalTextAlignment = TextAlignment.Center });
stackContainer.Children.Add(secondCheckboxStack);

expander.Content = stackContainer;
mainStack.Children.Add(expander);

In order to use the control in C#, you need to add the following namespace:

using Telerik.Maui.Controls;

Additional Resources

See Also

In this article
Not finding the help you need?