We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Button to start web API

Thread ID:





146913 Aug 25,2019 10:41 PM UTC Aug 26,2019 09:03 AM UTC Xamarin.Forms 1
Tags: SfButton
Asked On August 25, 2019 10:41 PM UTC

I'm trying to start a web API on button click but I have no idea how. I've already setup my button and the API has been added to the solution but I don't know how to call it with the button.

Muneesh Kumar G [Syncfusion]
Replied On August 26, 2019 09:03 AM UTC

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.  
            <buttons:SfButton  Text="Click Event" Clicked="SfButton_Clicked" HorizontalOptions="FillAndExpand" HeightRequest="40"/> 
            <buttons:SfButton  Text="ICommand" Command="{Binding ToggleCommand}" HorizontalOptions="FillAndExpand" HeightRequest="40"/> 
  private void SfButton_Clicked(object sender, EventArgs e) 
            // Task to perform on button click 
. . .  
  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.  
Muneesh Kumar G 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon