RoundedBoxView.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using Xamarin.Forms;
  2. namespace XamarinForms_CustomRenders.CustomControls
  3. {
  4. public class RoundedBoxView : BoxView
  5. {
  6. public static readonly BindableProperty CornerRadiusProperty =
  7. BindableProperty.Create<RoundedBoxView, double>(p => p.CornerRadius, 0);
  8. public double CornerRadius
  9. {
  10. get { return (double)base.GetValue(CornerRadiusProperty); }
  11. set { base.SetValue(CornerRadiusProperty, value); }
  12. }
  13. public static readonly BindableProperty StrokeProperty =
  14. BindableProperty.Create<RoundedBoxView, Color>(
  15. p => p.Stroke, Color.Transparent);
  16. public Color Stroke
  17. {
  18. get { return (Color)GetValue(StrokeProperty); }
  19. set { SetValue(StrokeProperty, value); }
  20. }
  21. public static readonly BindableProperty StrokeThicknessProperty =
  22. BindableProperty.Create<RoundedBoxView, double>(
  23. p => p.StrokeThickness, default(double));
  24. public double StrokeThickness
  25. {
  26. get { return (double)GetValue(StrokeThicknessProperty); }
  27. set { SetValue(StrokeThicknessProperty, value); }
  28. }
  29. }
  30. }