Skip to content

Latest commit

 

History

History
135 lines (82 loc) · 4.89 KB

events.md

File metadata and controls

135 lines (82 loc) · 4.89 KB
title page_title description position slug
Events
.NET MAUI ToggleButton Documentation - Events
Review the ToggleButton events that are raised when the button is pressed, clicked, released, or its toggle state changes.
7
togglebutton-events

.NET MAUI ToggleButton Events

The .NET MAUI ToggleButton emits a set of events that allow you to configure the component's behavior in response to specific user actions.

The .NET MAUI ToggleButton exposes the following events:

  • IsToggledChanged—Occurs when the RadToggleButton.IsToggled property is changed. The IsToggledChanged event handler receives two parameters:

    • The sender which is of type Telerik.Maui.Controls.RadToggleButton.
    • ValueChangedEventArgs which provides the following properties:
      • NewValue(TValue)—Gets the new value from the IsToggled property.
      • PreviousValue(TValue)—Gets the previous value of the IsToggled property.
  • Clicked—Raised when the RadToggleButton is clicked. The Clicked event handler receives two parameters:

    • The sender argument which is of type RadToggleButton.
    • An EventArgs object which provides information about the Clicked event.
  • Pressed—Raised when RadToggleButton is pressed (a finger presses on the buton, or a mouse button is pressed with a pointer positioned over the button). The Pressed event handler receives two parameters:

    • The sender argument which is of type RadToggleButton.
    • An EventHandler object which provides information on the Pressed event.
  • Released—Raised when the RadToggleButton is released (the finger or mouse button is released). The Released event handler receives two parameters:

    • The sender argument which is of type RadToggleButton.
    • An EventHandler object which provides information on the Released event.

Using the IsToggledChanged Event

The following example demonstrates how to use the IsToggledChanged event:

1. Define the button in XAML:

2. Add the telerik namespace:

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

3. Add the IsToggledChanged event:

This is the result on Android:

.NET MAUI ToggleButton IsToggledChanged Event

For a runnable example demonstrating the ToggleButton IsToggledChanged event, see the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}) and go to the ToggleButton > Events category.

Using the Clicked Event

The following example demonstrates how to use the Clicked event:

1. Define the button in XAML:

2. Add the telerik namespace:

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

3. Add the Clicked event:

This is the result on Android:

.NET MAUI ToggleButton Clicked Event

For a runnable example demonstrating the ToggleButton Clicked event, see the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}) and go to the ToggleButton > Events category.

Using the Pressed Event

The following example demonstrates how to use the Pressed event:

1. Define the button in XAML:

2. Add the telerik namespace:

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

3. Add the Pressed event:

This is the result on Android:

.NET MAUI ToggleButton Pressed Event

For a runnable example demonstrating the ToggleButton Pressed event, see the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}) and go to the ToggleButton > Events category.

Using the Released Event

The following example demonstrates how to use the Released event:

1. Define the button in XAML:

2. Add the telerik namespace:

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

3. Add the Released event:

This is the result on Android:

.NET MAUI ToggleButton Released Event

For a runnable example demonstrating the ToggleButton Released event, see the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}) and go to the ToggleButton > Events category.

See Also

  • [Configure the ToggleButton]({%slug togglebutton-configuration%})
  • [Toggle State]({%slug togglebutton-toggle-states%})
  • [Set Visual States]({%slug togglebutton-visual-states%})
  • [Execute Command]({%slug togglebutton-command%})
  • [Style the ToggleButton]({%slug togglebutton-styling%})