All Projects → softlion → XamarinFormsGesture

softlion / XamarinFormsGesture

Licence: Apache-2.0 License
Xamarin Form Gesture Effects

Programming Languages

C#
18002 projects
powershell
5483 projects

Projects that are alternatives of or similar to XamarinFormsGesture

gestures
A library for normalized events and gesture for desktop and mobile.
Stars: ✭ 31 (-63.53%)
Mutual labels:  tap, swipe, gesture
Any Touch
👋 手势库, 按需2kb~5kb, 兼容PC / 移动端
Stars: ✭ 567 (+567.06%)
Mutual labels:  tap, swipe, gesture
Gesturerecognizerclosures
Closure support for handling gesture recognizers in Swift.
Stars: ✭ 84 (-1.18%)
Mutual labels:  tap, swipe
Androiduigesturerecognizer
AndroidGestureRecognizer is an Android implementation of the Apple's UIGestureRecognizer framework
Stars: ✭ 119 (+40%)
Mutual labels:  tap, swipe
simple gesture detector
Easy to use, reliable and lightweight gesture detector for Flutter apps, exposing simple API for basic gestures
Stars: ✭ 26 (-69.41%)
Mutual labels:  swipe, gesture
Connectivityplugin
Connectivity Plugin for Xamarin and Windows
Stars: ✭ 253 (+197.65%)
Mutual labels:  uwp, xamarin-forms
Showtime
The easiest way to show off your iOS taps and gestures for demos and videos.
Stars: ✭ 281 (+230.59%)
Mutual labels:  tap, gesture
LaunchMapsPlugin
Launch External Maps Plugin for Xamarin and Windows
Stars: ✭ 49 (-42.35%)
Mutual labels:  uwp, xamarin-forms
Microsoft.maui.graphics
Stars: ✭ 160 (+88.24%)
Mutual labels:  uwp, xamarin-forms
FavFighters
Xamarin.Forms goodlooking UI sample using the new SwipeView.
Stars: ✭ 32 (-62.35%)
Mutual labels:  swipe, xamarin-forms
Xalami
A delicious way to kickstart your Xamarin Forms project
Stars: ✭ 18 (-78.82%)
Mutual labels:  uwp, xamarin-forms
ColorPicker
Color pickers for Xamarin Forms.
Stars: ✭ 38 (-55.29%)
Mutual labels:  uwp, xamarin-forms
Camelotia
Cross-platform .NET sample GUI app for cloud file management. Built with ReactiveUI, AvaloniaUI, Universal Windows Platform, Xamarin Forms, and WPF, runs on Windows, Linux, Mac and Android.
Stars: ✭ 221 (+160%)
Mutual labels:  uwp, xamarin-forms
Xamarin Demos
This repository contains the Syncfusion Xamarin UI control’s samples and the guide to use them.
Stars: ✭ 218 (+156.47%)
Mutual labels:  uwp, xamarin-forms
Caliburn.micro
A small, yet powerful framework, designed for building applications across all XAML platforms. Its strong support for MV* patterns will enable you to build your solution quickly, without the need to sacrifice code quality or testability.
Stars: ✭ 2,404 (+2728.24%)
Mutual labels:  uwp, xamarin-forms
fusuma-plugin-tap
Tap and Hold gestures plugin for Fusuma
Stars: ✭ 16 (-81.18%)
Mutual labels:  tap, gesture
Simpleauth
The Simplest way to Authenticate and make Rest API calls in .Net
Stars: ✭ 148 (+74.12%)
Mutual labels:  uwp, xamarin-forms
Xamarines
🕹️📱Cross-Platform Nintendo Emulator using Xamarin and .Net Standard!
Stars: ✭ 153 (+80%)
Mutual labels:  uwp, xamarin-forms
XamFormsMvxTemplate
A Visual Studio 2017 template for projects based on Xamarin.Forms 3.3 and MvvmCross 6.2
Stars: ✭ 27 (-68.24%)
Mutual labels:  uwp, xamarin-forms
EBind
🔵 .NET Data Binding we deserve: concise, fast, feature-rich
Stars: ✭ 141 (+65.88%)
Mutual labels:  uwp, xamarin-forms

Build status

NuGet
NuGet
Nuget

Supported Platforms

iOS, Android, UWP

Xamarin Form Gesture Effects

Add "advanced" gestures to Xamarin Forms. Available on all views. Most gesture commands include the event position.

    <Label Text="Click here" IsEnabled="True" ui:Gesture.TapCommand="{Binding OpenLinkCommand}" />

Or in code:

    var label = new Label();
    Vapolia.Lib.Ui.Gesture.SetTapCommand(label, new Command(() => { /*your code*/ }));

Quick start

Add the above nuget package to your Xamarin Forms project (only the netstandard one is enough).

In your platform projects (android,ios,uwp), before initializing xamarin forms, call PlatformGestureEffect.Init() to force the discovery of this extension by the Xamarin Forms plugin engine.

The views on which the gesture is applied should have the property IsEnabled="True" and InputTransparent="False" which activates user interaction on them.

Examples

Add Gesture.TapCommand on any supported xaml view:

        <StackLayout ui:Gesture.TapCommand="{Binding OpenLinkCommand}">
            <Label Text="1.Tap this to open an url"  />
        </StackLayout>

Declare the corresponding namespace:

    <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             ...
             xmlns:ui="clr-namespace:Vapolia.Lib.Ui;assembly=XamarinFormsGesture"
    >

And in the viewmodel:

 public Command OpenLinkCommand => new Command(() =>
 {
     //do something
 });

Supported Gestures

  • TapCommand (ICommand)
  • DoubleTapCommand (ICommand)
  • PanCommand (ICommand)
  • LongPressCommand (ICommand)
  • TapPointCommand (ICommand or Command<Point>) where point is the absolute tap position relative to the view
  • DoubleTapPoinCommand (ICommand or Command<Point>) where point is the absolute double tap position relative to the view
  • PanPointCommand (ICommand or Command<PanEventArgs>) where point is the absolute position relative to the view
  • LongPressPointCommand (ICommand or Command<Point>) where point is the absolute tap position relative to the view
  • SwipeLeftCommand
  • SwipeRightCommand
  • SwipeTopCommand
  • SwipeBottomCommand
  • PinchCommand (Command<PinchEventArgs>) where PinchEventArg contains StartingPoints, CurrentPoints, Center, Scale, RotationRadians, RotationDegrees, Status

Properties:

  • IsPanImmediate Set to true to receive the PanCommand or PanPointCommand event on touch down, instead of after a minimum move distance. Default to false.

Examples

Somme commands in XAML

<StackLayout ui:Gesture.TapCommand="{Binding OpenCommand}" IsEnabled="True">
    <Label Text="1.Tap this text to open an url" />
</StackLayout>

<StackLayout ui:Gesture.DoubleTapPointCommand="{Binding OpenPointCommand}" IsEnabled="True">
    <Label Text="2.Double tap this text to open an url" />
</StackLayout>

<BoxView
    ui:Gesture.PanPointCommand="{Binding PanPointCommand}"
    HeightRequest="200" WidthRequest="300"
    InputTransparent="False"
    IsEnabled="True"
     />

In the viewmodel:

public ICommand OpenCommand => new Command(async () =>
{
   //...
});

public ICommand OpenPointCommand => new Command<Point>(point =>
{
    PanX = point.X;
    PanY = point.Y;
    //...
});

public ICommand PanPointCommand => new Command<PanEventArgs>(args =>
{
    var point = args.Point;
    PanX = point.X;
    PanY = point.Y;
    //...
});

Exemple in C# on a Grid containing an horizontal slider (set value on tap)

//Tap anywhere to set value
Gesture.SetTapPointCommand(this, new Command<Point>(pt =>
{
    var delta = (pt.X - Padding.Left) / (Width - Padding.Left - Padding.Right);
    if(delta<0 || delta>1)
        return;
    Value = (int)Math.Round((Maximum - Minimum) * delta);
}));

Limitations

Only commands are supported (PR welcome for events). No .NET events. So you must use the MVVM pattern (https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/data_bindings_to_mvvm/).

Swipe commands are not supported on UWP due to a bug (event not received). If you find it, notify me! PinchCommand is not supported (yet) on UWP. PR welcome.

If your command is not receiving events, make sure that:

  • you used the correct handler. Ie: the LongPressPointCommand should be new Command<Point>(pt => ...)
  • you set IsEnabled="True" and InputTransparent="False" on the element

UWP requires fall creator update

Breaking changes

Version 3.3.0 has breaking changes:

  • Command names have changed
  • PanPointCommand returns an absolute position, not a relative position anymore. It also returns the gesture state. The gesture can also be cancelled.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].