Search⌘ K

Multi-Triggers

Explore how to use multi-triggers in .NET MAUI to create dynamic user interfaces that respond to multiple property and data conditions. Understand configuring triggers for Entry and Button controls to manage UI changes like text color and button states.

Multi-triggers are fired when multiple conditions are met. We'll cover how to use them in .NET MAUI with the aid of the following project setup and some examples:

<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:MultiTriggersDemo"
             x:Class="MultiTriggersDemo.App">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/Styles/Colors.xaml" />
                <ResourceDictionary Source="Resources/Styles/Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
.NET MAUI project example with multi-triggers demonstration

Using property triggers in multi-triggers

If we open the MainPage.xaml file in the project setup above, we'll see a global multi-trigger defined in the ContentPage.Resources element on lines 6–19. The multi-trigger itself is defined in the ...