using System; using Xamarin.Forms.Platform; namespace Xamarin.Forms { [RenderWith(typeof(_BoxViewRenderer))] public class BoxView : View, IColorElement, ICornerElement, IElementConfiguration { public static readonly BindableProperty ColorProperty = ColorElement.ColorProperty; public static readonly BindableProperty CornerRadiusProperty = CornerElement.CornerRadiusProperty; readonly Lazy> _platformConfigurationRegistry; public BoxView() { _platformConfigurationRegistry = new Lazy>(() => new PlatformConfigurationRegistry(this)); } public Color Color { get => (Color)GetValue(ColorElement.ColorProperty); set => SetValue(ColorElement.ColorProperty, value); } public CornerRadius CornerRadius { get => (CornerRadius)GetValue(CornerElement.CornerRadiusProperty); set => SetValue(CornerElement.CornerRadiusProperty, value); } public IPlatformElementConfiguration On() where T : IConfigPlatform { return _platformConfigurationRegistry.Value.On(); } [Obsolete("OnSizeRequest is obsolete as of version 2.2.0. Please use OnMeasure instead.")] protected override SizeRequest OnSizeRequest(double widthConstraint, double heightConstraint) { return new SizeRequest(new Size(40, 40)); } } }