MobileCard.cs 916 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. using System.Windows.Input;
  4. using Xamarin.Forms;
  5. namespace InABox.Mobile
  6. {
  7. public class MobileCard : Frame
  8. {
  9. public MobileCard()
  10. {
  11. CornerRadius = 5;
  12. Margin = 0;
  13. Padding = 2;
  14. BorderColor = Color.Gray;
  15. BackgroundColor = Color.White;
  16. HasShadow = false;
  17. IsEnabled = true;
  18. GestureRecognizers.Add(new TapGestureRecognizer
  19. {
  20. Command = new Command(OnClick)
  21. });
  22. }
  23. public event EventHandler Clicked;
  24. protected virtual async void OnClick()
  25. {
  26. if (IsEnabled)
  27. {
  28. Scale = 0.5;
  29. await this.ScaleTo(1, 150);
  30. Clicked?.Invoke(this, EventArgs.Empty);
  31. }
  32. }
  33. }
  34. }