Skip to content

Files

Latest commit

May 13, 2024
6513185 · May 13, 2024

History

History
46 lines (30 loc) · 1.53 KB
·

command.md

File metadata and controls

46 lines (30 loc) · 1.53 KB
·
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

.NET MAUI 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.

Using the Command and CommandParameter

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:

.NET MAUI ToggleButton Command

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

See Also

  • [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%})