using System; using Xamarin.Forms; namespace Billing.UI { public class TintHelper { public const string TintColor = nameof(TintColor); public static readonly BindableProperty TintColorProperty = BindableProperty.CreateAttached(TintColor, typeof(Color?), typeof(TintHelper), null); public static void SetTintColor(BindableObject obj, Color? color) => obj.SetValue(TintColorProperty, color); public static Color? GetTintColor(BindableObject obj) => (Color?)obj.GetValue(TintColorProperty); } public class TintImage : Image { } public class TintImageButton : ImageButton { } public class LongPressButton : Button { public event EventHandler LongPressed; public LongPressButton() { Padding = 0; BackgroundColor = Color.Transparent; } public void TriggerLongPress() { LongPressed?.Invoke(this, EventArgs.Empty); } } public class LongPressGrid : Grid { public static readonly BindableProperty LongCommandProperty = BindableProperty.Create(nameof(LongCommand), typeof(Command), typeof(LongPressGrid)); public static readonly BindableProperty LongCommandParameterProperty = BindableProperty.Create(nameof(LongCommandParameter), typeof(object), typeof(LongPressGrid)); public Command LongCommand { get => (Command)GetValue(LongCommandProperty); set => SetValue(LongCommandProperty, value); } public object LongCommandParameter { get => GetValue(LongCommandParameterProperty); set => SetValue(LongCommandParameterProperty, value); } public void TriggerLongPress() { var command = LongCommand; if (command == null) { return; } var parameter = LongCommandParameter; if (command.CanExecute(parameter)) { command.Execute(parameter); } } } public class BlurryPanel : ContentView { } }