MobileCard.cs 809 B

12345678910111213141516171819202122232425262728293031323334353637
  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 void OnClick()
  25. {
  26. if (IsEnabled)
  27. Clicked?.Invoke(this, EventArgs.Empty);
  28. }
  29. }
  30. }