Hi Prince,
Greetings from Syncfusion,
We can able to perform click action in SfButton in two ways.
1. Using Click event.
2. Using ICommand interface.
Both the method will fire at the time of button tapped.
[xaml]
<StackLayout>
<buttons:SfButton Text="Click Event" Clicked="SfButton_Clicked" HorizontalOptions="FillAndExpand" HeightRequest="40"/>
<buttons:SfButton Text="ICommand" Command="{Binding ToggleCommand}" HorizontalOptions="FillAndExpand" HeightRequest="40"/>
</StackLayout> |
[c#]
private void SfButton_Clicked(object sender, EventArgs e)
{
// Task to perform on button click
}
//ViewModel
. . .
public ICommand ToggleCommand { private set; get; }
. . .
ToggleCommand = new Command(
execute: () =>
{
Console.WriteLine("This is execute of ToggleCommand!");
},
canExecute: () =>
{
return true;
});
. . . |
If your requirement is different from this, please revert us by modifying the below sample or provide more information. That will help us to provide solution earlier.
Regards,
Muneesh Kumar G