2016-08-30 20:46:14 +03:00
|
|
|
using System;
|
2016-03-22 23:02:25 +03:00
|
|
|
using Xamarin.Forms.Platform;
|
|
|
|
|
|
|
|
namespace Xamarin.Forms
|
|
|
|
{
|
|
|
|
[ContentProperty("Content")]
|
|
|
|
[RenderWith(typeof(_FrameRenderer))]
|
2016-08-30 20:46:14 +03:00
|
|
|
public class Frame : ContentView, IElementConfiguration<Frame>
|
2016-03-22 23:02:25 +03:00
|
|
|
{
|
|
|
|
public static readonly BindableProperty OutlineColorProperty = BindableProperty.Create("OutlineColor", typeof(Color), typeof(Frame), Color.Default);
|
|
|
|
|
|
|
|
public static readonly BindableProperty HasShadowProperty = BindableProperty.Create("HasShadow", typeof(bool), typeof(Frame), true);
|
|
|
|
|
2016-11-01 12:35:14 +03:00
|
|
|
public static readonly BindableProperty CornerRadiusProperty =
|
|
|
|
BindableProperty.Create(nameof(CornerRadius), typeof(float), typeof(Frame), -1.0f,
|
|
|
|
validateValue: (bindable, value) => ((float)value) == -1.0f || ((float)value) >= 0f);
|
2016-10-09 10:52:38 +03:00
|
|
|
|
2016-08-30 20:46:14 +03:00
|
|
|
readonly Lazy<PlatformConfigurationRegistry<Frame>> _platformConfigurationRegistry;
|
|
|
|
|
2016-03-22 23:02:25 +03:00
|
|
|
public Frame()
|
|
|
|
{
|
|
|
|
Padding = new Size(20, 20);
|
2016-08-30 20:46:14 +03:00
|
|
|
_platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Frame>>(() => new PlatformConfigurationRegistry<Frame>(this));
|
2016-03-22 23:02:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public bool HasShadow
|
|
|
|
{
|
|
|
|
get { return (bool)GetValue(HasShadowProperty); }
|
|
|
|
set { SetValue(HasShadowProperty, value); }
|
|
|
|
}
|
|
|
|
|
|
|
|
public Color OutlineColor
|
|
|
|
{
|
|
|
|
get { return (Color)GetValue(OutlineColorProperty); }
|
|
|
|
set { SetValue(OutlineColorProperty, value); }
|
|
|
|
}
|
2016-08-30 20:46:14 +03:00
|
|
|
|
2016-10-09 10:52:38 +03:00
|
|
|
public float CornerRadius
|
|
|
|
{
|
|
|
|
get { return (float)GetValue(CornerRadiusProperty); }
|
|
|
|
set { SetValue(CornerRadiusProperty, value); }
|
|
|
|
}
|
|
|
|
|
2016-08-30 20:46:14 +03:00
|
|
|
public IPlatformElementConfiguration<T, Frame> On<T>() where T : IConfigPlatform
|
|
|
|
{
|
|
|
|
return _platformConfigurationRegistry.Value.On<T>();
|
|
|
|
}
|
2016-03-22 23:02:25 +03:00
|
|
|
}
|
|
|
|
}
|