Events in .NET MAUI Button (SfButton)

24 Jul 20261 minute to read

The .NET MAUI Button raises event when the user taps or clicks.

Prerequisites

Before using the SfButton, ensure the following NuGet package is installed in your .NET MAUI project:

  • Syncfusion.Maui.Buttons

For a step-by-step setup, refer to the Getting Started documentation.

Clicked Event

The Clicked event is raised when the user taps or clicks the Button. The event handler receives an EventArgs argument and is invoked once per tap.

The following code samples subscribe to the Clicked event and change the text color when the button is tapped.

<buttons:SfButton x:Name="button"
                  Text="Button"
                  Clicked="OnButtonClicked" />
SfButton button = new SfButton();
button.Text = "Button";
button.Clicked += OnButtonClicked;

The Clicked event can be handled in C# as follows:

private void OnButtonClicked(object sender, EventArgs e)
{
    // Retrieve the button instance from the sender parameter.
    if (sender is SfButton clickedButton)
    {
        clickedButton.TextColor = Colors.Blue;
    }
}

See Also