using System.Windows.Input; using Xamarin.Forms; using Xamarin.Forms.Shapes; using Xamarin.Forms.Xaml; namespace Shared.Xamarin.Controls { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class IconButton : ContentView { public IconButton() { InitializeComponent(); } public ICommand Command { get => GetValue(CommandProperty) as ICommand; set => SetValue(CommandProperty, value); } public object CommandParameter { get => GetValue(CommandParameterProperty); set => SetValue(CommandParameterProperty, value); } [TypeConverter(typeof(PathGeometryConverter))] public Geometry Data { get => GetValue(DataProperty) as Geometry; set => SetValue(DataProperty, value); } public Brush Fill { get => GetValue(FillProperty) as Brush; set => SetValue(FillProperty, value); } public double Size { get => (double) GetValue(SizeProperty); set => SetValue(SizeProperty, value); } public static readonly BindableProperty CommandProperty = BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(IconButton)); public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(IconButton)); public static readonly BindableProperty SizeProperty = BindableProperty.Create(nameof(Size), typeof(double), typeof(IconButton), 32.0); public static readonly BindableProperty DataProperty = BindableProperty.Create(nameof(Data), typeof(Geometry), typeof(IconButton)); public static readonly BindableProperty FillProperty = BindableProperty.Create(nameof(Fill), typeof(Brush), typeof(IconButton), Brush.Default); } }