.NET MAUI TemplatedButton Events
The .NET MAUI TemplatedButton emits a set of events that allow you to configure the component's behavior in response to specific user actions.
The .NET MAUI TemplatedButton exposes the following events:
-
Clicked—Raised when theRadTemplatedButtonis clicked. TheClickedevent handler receives two parameters:- The
senderargument which is of typeRadTemplatedButton. - An
EventArgsobject which provides information about theClickedevent.
- The
-
Pressed—Raised whenRadTemplatedButtonis pressed (a finger presses on the buton, or a mouse button is pressed with a pointer positioned over the button). ThePressedevent handler receives two parameters:- The
senderargument which is of typeRadTemplatedButton. - An
EventHandlerobject which provides information about thePressedevent.
- The
-
Released—Raised when theRadTemplatedButtonis released (the finger or mouse button is released). TheReleasedevent handler receives two parameters:- The
senderargument which is of typeRadTemplatedButton. - An
EventHandlerobject which provides information about theReleasedevent.
- The
Using the Clicked Event
The following example demonstrates how to use the Clicked event.
1. Define the button in XAML:
<telerik:RadTemplatedButton x:Name="templatedButton"
Content="My Button"
Clicked="OnRadTemplatedButtonClicked" />
<Label x:Name="label" Text="TemplatedButton is clicked 0 times" />
2. Add the telerik namespace:
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
3. Add the Clicked event:
private void OnRadTemplatedButtonClicked(object sender, System.EventArgs e)
{
count++;
if (count == 1)
{
this.label.Text = $"TemplatedButton is clicked {count} time";
}
else
{
this.label.Text = $"TemplatedButton is clicked {count} times";
}
}
This is the result on WinUI:

For a runnable example demonstrating the TemplatedButton Clicked event, see the SDKBrowser Demo Application and go to the TemplatedButton > Events category.
Using the Pressed Event
The following example demonstrates how to use the Pressed event.
1. Define the button in XAML:
<telerik:RadTemplatedButton x:Name="templatedButton"
Content="My Templated Button"
Pressed="OnTemplatedButtonPressed" />
<Label x:Name="label" Text="TemplatedButton is pressed 0 times" />
2. Add the telerik namespace:
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
3. Add the Pressed event:
private void OnTemplatedButtonPressed(object sender, System.EventArgs e)
{
count++;
if (count == 1)
{
this.label.Text = $"TemplatedButton is pressed {count} time";
}
else
{
this.label.Text = $"TemplatedButton is pressed {count} times";
}
}
This is the result on WinUI:

For a runnable example demonstrating the TemplatedButton Pressed event, see the SDKBrowser Demo Application and go to the TemplatedButton > Events category.
Using the Released Event
The following example demonstrates how to use the Released event.
1. Define the button in XAML:
<telerik:RadTemplatedButton x:Name="templatedButton"
Content="My Button"
Released="OnTemplatedButtonReleased" />
<Label x:Name="label" Text="TemplatedButton is released 0 times" />
2. Add the telerik namespace:
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
3. Add the Released event:
private void OnTemplatedButtonReleased(object sender, System.EventArgs e)
{
count++;
if (count == 1)
{
this.label.Text = $"TemplatedButton is released {count} time";
}
else
{
this.label.Text = $"TemplatedButton is released {count} times";
}
}
This is the result on WinUI:

For a runnable example demonstrating the TemplatedButton Released event, see the SDKBrowser Demo Application and go to the TemplatedButton > Events category.