title | page_title | description | position | slug |
---|---|---|---|---|
Command |
.NET MAUI ToggleButton Documentation - Command |
Learn how to use the ToggleButton Command that is executed when the button is clicked or tapped. |
8 |
togglebutton-command |
The Telerik .NET MAUI ToggleButton allows you to attach a command that executes when the button is clicked.
Command
(ICommand
)—Defines the command which executes when the button is clicked.CommandParameter
(object
)—Specifies the parameter of the command which executes when the button is clicked.
The following example demonstrates how to use the Command
.
1. Define the ToggleButton in XAML:
2. Add the telerik
namespace:
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
3. Add the ViewModel
:
This is the result on Android:
For a runnable example demonstrating the ToggleButton Command, see the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}) and go to the ToggleButton > Features category.
- [Configure the ToggleButton]({%slug togglebutton-configuration%})
- [Toggle State]({%slug togglebutton-toggle-states%})
- [Set Visual States]({%slug togglebutton-visual-states%})
- [Events]({%slug togglebutton-events%})
- [Style the ToggleButton]({%slug togglebutton-styling%})