.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 theRadToggleButton.IsToggled
property is changed. TheIsToggledChanged
event handler receives two parameters:- The
sender
which is of typeTelerik.Maui.Controls.RadToggleButton
. -
ValueChangedEventArgs
which provides the following properties:-
NewValue
(TValue
)—Gets the new value from theIsToggled
property. -
PreviousValue
(TValue
)—Gets the previous value of theIsToggled
property.
-
- The
-
Clicked
—Raised when theRadToggleButton
is clicked. TheClicked
event handler receives two parameters:- The
sender
argument which is of typeRadToggleButton
. - An
EventArgs
object which provides information about theClicked
event.
- The
-
Pressed
—Raised whenRadToggleButton
is pressed (a finger presses on the buton, or a mouse button is pressed with a pointer positioned over the button). ThePressed
event handler receives two parameters:- The
sender
argument which is of typeRadToggleButton
. - An
EventHandler
object which provides information on thePressed
event.
- The
-
Released
—Raised when theRadToggleButton
is released (the finger or mouse button is released). TheReleased
event handler receives two parameters:- The
sender
argument which is of typeRadToggleButton
. - An
EventHandler
object which provides information on theReleased
event.
- The
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:
3. Add the IsToggledChanged
event:
This is the result on Android:
For a runnable example demonstrating the ToggleButton
IsToggledChanged
event, see the SDKBrowser Demo Application 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:
3. Add the Clicked
event:
This is the result on Android:
For a runnable example demonstrating the ToggleButton
Clicked
event, see the SDKBrowser Demo Application 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:
3. Add the Pressed
event:
This is the result on Android:
For a runnable example demonstrating the ToggleButton
Pressed
event, see the SDKBrowser Demo Application 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:
3. Add the Released
event:
This is the result on Android:
For a runnable example demonstrating the ToggleButton
Released
event, see the SDKBrowser Demo Application and go to the ToggleButton > Events category.