67 lines
2.0 KiB
C#
67 lines
2.0 KiB
C#
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 = Helper.Create<Command, LongPressGrid>(nameof(LongCommand));
|
|
public static readonly BindableProperty LongCommandParameterProperty = Helper.Create<object, LongPressGrid>(nameof(LongCommandParameter));
|
|
|
|
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 { }
|
|
} |