Pixiview/Pixiview/Utils/LongPressEffect.cs

27 lines
1.2 KiB
C#

using System.Windows.Input;
using Xamarin.Forms;
namespace Pixiview.Utils
{
public class LongPressEffect : RoutingEffect
{
private const string Command = nameof(Command);
private const string CommandParameter = nameof(CommandParameter);
public static readonly BindableProperty CommandProperty = BindableProperty.CreateAttached(
Command, typeof(ICommand), typeof(LongPressEffect), null);
public static readonly BindableProperty CommandParameterProperty = BindableProperty.CreateAttached(
CommandParameter, typeof(object), typeof(LongPressEffect), null);
public static ICommand GetCommand(BindableObject view) => (ICommand)view.GetValue(CommandProperty);
public static void SetCommand(BindableObject view, ICommand command) => view.SetValue(CommandProperty, command);
public static object GetCommandParameter(BindableObject view) => view.GetValue(CommandParameterProperty);
public static void SetCommandParameter(BindableObject view, object value) => view.SetValue(CommandParameterProperty, value);
public LongPressEffect() : base("Pixiview.LongPressEffect")
{
}
}
}