Home

Awesome

MultiGestureView

Extended ContentView with Events for gestures like Tap, Long Press and Right Click. Also supports Vibration and Vibration duration for haptic feedback.

Setup :

MultiGestureViewRenderer.Init();

The library needs Vibration permission in Android for vibration to work. The permission should automatically be added if installed from NuGet. If the vibration still doesn't work, try adding the Vibration permission explicitly.

Gesture Support :

PlatformLong PressTapRight Click
Xamarin.iOS UnifiedYesYesNo
Xamarin.AndroidYesYesNo
UWPNoYesYes

Basic Usage :

var gestureView = new MultiGestureView()
{
    VibrateOnTap = true,
    TapVibrationDuration = 150,
    VibrateOnLongPress = true,
    LongPressVibrationDuration = 300,
    HeightRequest = 300,
    WidthRequest = 300,
    BackgroundColor = Color.Salmon,
    HorizontalOptions = LayoutOptions.Center,
    VerticalOptions = LayoutOptions.Center,
    Content = new Label() { Text = "Hello World!", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center }
};

gestureView.Tapped += (s, e) =>
{
    DisplayAlert("Tapped", "Tap gesture detected.", "Ok");
};

gestureView.LongPressed += (s, e) =>
{
    DisplayAlert("Long Pressed", "Long press gesture detected.", "Ok");
};

gestureView.RightClicked += (s, e) =>
{
    DisplayAlert("Right Click", "Right click detected.", "Ok");
};
<multigestureviewplugin:MultiGestureView
    x:Name="theMgv"
    Padding="30"
    BackgroundColor="Salmon"
    HeightRequest="200"
    HorizontalOptions="Center"
    LongPressVibrationDuration="1000"
    LongPressedCommand="{Binding MyLongPressedCommand}"
    RightClickedCommand="{Binding MyRightClickedCommand}"
    TapVibrationDuration="500"
    TappedCommand="{Binding MyTappedCommand}"
    TappedCommandParameter="{Binding Source={x:Reference theMgv}}"
    VibrateOnLongPress="True"
    VibrateOnTap="True">
    <Label
        FontSize="Large"
        HorizontalOptions="Center"
        Text="Click / Right-Click / Long Press here"
        TextColor="White"
        VerticalOptions="Center" />
</multigestureviewplugin:MultiGestureView>