Forum Xamarin.Forms

Multiple clicks on a button

ElPiponElPipon COMember ✭✭

Hello everyone.

How can validate that the button is click many times.

I use MVVM with using GalaSoft.MvvmLight.Command

My code page.xaml is next

            <Button Text="Por Descripcion"
            Command="{Binding DescriptionCommand}"
            TextColor="{StaticResource FontColor}"

Command do the function of click in button


  • ionixjuniorionixjunior USMember ✭✭✭
    edited June 2017

    Hi @ElPipon, do you need to detect double click?

  • ElPiponElPipon COMember ✭✭
    edited June 2017

    Double or multiple, Both. Please

  • JohnHardmanJohnHardman GBUniversity mod

    @ElPipon - Is the objective to simply avoid acting on a Button press more than once? i.e. the user accidentally double-taps rather than single-taps, and you don't want to act on it twice in that situation?

    Or, is the idea to actually do something different for single-taps, double-taps, or multi-taps?

    The starting point for any of these is to get the current date/time each time the Button is clicked and compare against the previous date/time values. Where implementation differs is if you want to do different things for different numbers of taps. If that is the case, you also need to start a timer when the first tap is done. If the timer reaches some value before a second or subsequent tap is done, then you execute the action for the number of taps done so far.

Sign In or Register to comment.