3

I want to put button click effect in Xamarin forms. How can I do this? Am I need to use any plugin or any best way.

EDITED

I am creating Xamarin.Forms application and I want to make a more user-friendly button click. So, a user can feel like the button was pressed.

1 Answer 1

10

You need to create custom button like below:

public class CustomButton : Button
    {
        public CustomButton() : base()
        {
            const int _animationTime = 10;
            Clicked += async (sender, e) =>
            {
                try
                {
                    var btn = (CustomButton)sender;
                    await btn.ScaleTo(1.2, _animationTime);
                    await btn.ScaleTo(1, _animationTime);
                }
                catch (Exception ex)
                {
                    ex.Track();
                }
            };

        }
    }
2
  • Perfect solution, Thanks Pavan Jul 20, 2017 at 7:38
  • Then accept his answer
    – Yuri S
    Jul 20, 2017 at 15:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.