locked
MR.Gestures handles ALL touch gestures RRS feed

  • Question

  • User57869 posted

    With MR.Gestures you can handle the Tapping, Tapped, DoupleTapped, LongPressing, LongPressed, Panning, Panned, Swiped, Pinching, Pinched, Rotating and Rotated gestures on all layouts, cells, views and on the ContentPage.

    The code can be as easy as

        var box1 = new MR.Gestures.BoxView { Color = Color.Red };
        box1.LongPressed += (s, e) => { Console.WriteLine("Code: Red LongPressed"); };
    

    Or in XAML

    ```

             Padding="50"
    
             TappingCommand="{Binding TappingCommand}"
             TappedCommand="{Binding TappedCommand}"
             DoubleTappedCommand="{Binding DoubleTappedCommand}"
             LongPressingCommand="{Binding LongPressingCommand}"
             LongPressedCommand="{Binding LongPressedCommand}"
             PanningCommand="{Binding PanningCommand}"
             PannedCommand="{Binding PannedCommand}"
             SwipedCommand="{Binding SwipedCommand}"
             PinchingCommand="{Binding PinchingCommand}"
             PinchedCommand="{Binding PinchedCommand}"
             RotatingCommand="{Binding RotatingCommand}"
             RotatedCommand="{Binding RotatedCommand}"
             >
    

    ```

    MR.Gestures is available via NuGet. More info on http://www.mrgestures.com/.

    There is also a sample app available to download from https://github.com/MichaelRumpler/GestureSample. The GestureSample demonstrates how to use all the gestures with all Xamarin.Forms elements.

    Thursday, February 12, 2015 8:18 AM

Answers

  • User57869 posted

    The new version 1.0.5-pre1 is now released. 1.0.5 will come out with XF 1.0.5.

    After six releases which had no changes at all - they were just compiled with different Xamarin.Forms versions - we now have the first changes.

    • On iOS I conquered the internal renderers and get almost all events now. Just the Button is a bit persistent. Details at http://www.mrgestures.com/#Compatibility
    • A memory leak has been fixed on Windows Phone. As Xamarins renderers don't implement IDisposable (like they do on iOS+Android) I cannot clean up correctly. I found a workaround if everything is on a NavigationPage - which is usually the case.
    • The timespan between two taps to recognize DoubleTapped can now be configured on each platform via Settings.MsUntilTapped
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Saturday, February 28, 2015 7:18 AM

All replies

  • User72465 posted

    Will never Xamarin provide these events in Xamarin.Forms controls itself?, or do we need to go with MR.Gestures libraries in future also?

    Thursday, February 12, 2015 11:18 AM
  • User57869 posted

    I cannot answer for Xamarin here. But they provided the TapGestureRecognizer in the very first Xamarin.Forms version in June 2014 and nothing else in the last eight months. They not even revealed plans to do so.

    Thursday, February 12, 2015 11:23 AM
  • User57869 posted

    I've been asked if MR.Gestures can handle Swipe within a TabbedPage within a MasterDetailPage. This is not so easy because the swipe is also used by the MasterDetailPage on iOS and Android and the TabbedPage on Windows Phone.

    So I copied the MasterDetailPageDemoPage, TabbedPageDemoPage and NamedColorPage from the Xamarin FormsGallery and adjusted them so that the MasterDetailPage now shows the TabbedPage as Detail. Then I added my gesture handling.

    The NamedColorPage inherits from MR.Gestures.ContentPage. As the swipe needs to be handled by the MasterDetailPage it must not handle the Panning, Panned or Swiped gestures. If you do that, then you cannot swipe to the Master page anymore on iOS. All other gestures can be handled by the NamedColorPage as usual.

    I also changed the BoxView within the NamedColorPage to a MR.Gestures.BoxView. This element can handle all gestures without problems. If you swipe within that BoxView, it will be recognized. If you swipe outside from the border on iOS and Android, you can go back to the Master page.

    On Windows Phone, the swipe will be used by the TabbedPage to switch tabs. This will still happen no matter where you swipe. But the BoxView will also be notified in the Swiped handler.

    I committed the new sample to https://github.com/MichaelRumpler/GestureSample.

    If you have any other special cases, you can always clone GestureSample and change it yourself to try it out. The license key for the GestureSample app is included so it will work like a full version.

    Wednesday, February 18, 2015 10:06 AM
  • User59941 posted

    var box1 = new MR.Gestures.BoxView { Color = Color.Red }; box1.LongPressed += (s, e) => { Console.WriteLine("Code: Red LongPressed");};

    Nice and simple, worked right off in Android using Version 1.0.4 NuGet. iOS didn't respond at all. Is there one extra bit of info I need to get it to function in iOS, like licensing? I didn't use the LicenseKey for my Droid app.

    Friday, February 20, 2015 8:31 PM
  • User57869 posted

    LongPressed should work without LicenseKey, but if you don't call anything from the dll, the linker thinks you don't need it and throws it away. So you should add

    MR.Gestures.iOS.Settings.LicenseKey = "";
    

    This will include the library, but the properties of the EventArgs will be empty. If you only need LongPressed, this should suffice. If you need swipe, pan, pinch or rotate, empty EventArgs will not be enough and you'll need to buy a license.

    Saturday, February 21, 2015 7:37 PM
  • User73752 posted

    I'am just playing around with your package, especially with the ContentPageXaml page on IPhone 4S. The sample works great, but if i change mr:ContentPage to ContentPage and Image to mr:Image and moving the commands to the mr:image, then the sample is slow and flicker. The panning goes wrong after rotating the image

    <RelativeLayout>
        <ContentView Padding="50"
                RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=0}"
                RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=0}"
                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width}"
                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height}">
    
            <mr:Image 
                TappingCommand="{Binding TappingCommand}"
                TappedCommand="{Binding TappedCommand}"
                PanningCommand="{Binding PanningCommand}"
                PannedCommand="{Binding PannedCommand}"
                SwipedCommand="{Binding SwipedCommand}"
                PinchingCommand="{Binding PinchingCommand}"
                PinchedCommand="{Binding PinchedCommand}"
                RotatingCommand="{Binding RotatingCommand}"
                RotatedCommand="{Binding RotatedCommand}"
                Source="{Binding ImageSource}"
                Scale="{Binding Scale}"
                Rotation="{Binding Rotation}"
                TranslationX="{Binding TranslationX}"
                TranslationY="{Binding TranslationY}"
                AnchorX="{Binding AnchorX}"
                AnchorY="{Binding AnchorY}"
            />
        </ContentView>
    
    </RelativeLayout>
    

    The intention ist to have two images, one fullscreen for pinching and panning, a second on top of the first image for pinching, rotating and panning. Any idea?

    Monday, February 23, 2015 1:30 PM
  • User57869 posted

    There are problems when you transform a view and listen to the gestures on that same view. E.g. when you rotate the image, the coordinates of the valid touch points cannot be expressed as X/Y/W/H anymore. I only knew that Android has a problem with that. Apparently iOS too.

    Therefore you should add the gesture listeners always to a container (layout or page) surrounding the element you want to transform. The container should not be transformed in any way.

    In your event handlers you can check the Touches property of the EventArgs for the coordinates of the fingers on the screen. You'll have to check on which image they are yourself.

    One more warning: if you have multiple elements on the screen which overlap and you want to listen to the gestures for both of them, there may also be problems. I'm currently working on getting the event bubbling right (event is not handled by a subview and should be forwarded to a superview). But the native gesture recognizer APIs are not very intuitive for me.

    Monday, February 23, 2015 4:03 PM
  • User73752 posted

    Thanks for the information. Now i handle the events from the page and obtain the touched image from the event args. Just for the demo is it ok, but not a clean MVVM pattern. Hope to handle this later witch custum renderes using your GestureHandlers.

    Tuesday, February 24, 2015 9:22 AM
  • User82074 posted

    Hello it seems to be it does´t work for ListView?

    Friday, February 27, 2015 1:42 PM
  • User57869 posted

    @zurbas

    The ListView works exactly as it should on iOS and Windows Phone. On Android Xamarins renderer consumes the gesture events and does not send them outside. But you can add the gesture handlers to the cells instead. This works on all platforms.

    This information is also available at http://www.mrgestures.com/#Compatibility

    I'm close to submitting a new version which fixes most incompatibilities on iOS. I just need a few hours more, but it will probably be too much for today.

    Friday, February 27, 2015 3:37 PM
  • User106639 posted

    I can't get it to work in my project added nuget dependencies to iOS project and to my forms project -but it just doesn't work...

    Whenever I open a xaml page with a mr gestures name spaced control I get an error : which say's that that

    Could not load file or assembly 'MR.Gestures' or one of its dependencies. The system cannot find the file specified.

    with FileName MR.Gestures. not sure what I'm doing wrong, and it's really a shame as I'm trying to do some spikes to appraise it's suitability beyond the samples that bundle with it.

    Friday, February 27, 2015 9:38 PM
  • User57869 posted

    The new version 1.0.5-pre1 is now released. 1.0.5 will come out with XF 1.0.5.

    After six releases which had no changes at all - they were just compiled with different Xamarin.Forms versions - we now have the first changes.

    • On iOS I conquered the internal renderers and get almost all events now. Just the Button is a bit persistent. Details at http://www.mrgestures.com/#Compatibility
    • A memory leak has been fixed on Windows Phone. As Xamarins renderers don't implement IDisposable (like they do on iOS+Android) I cannot clean up correctly. I found a workaround if everything is on a NavigationPage - which is usually the case.
    • The timespan between two taps to recognize DoubleTapped can now be configured on each platform via Settings.MsUntilTapped
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Saturday, February 28, 2015 7:18 AM
  • User82074 posted

    thanks MR, thats was it i tried to do but i found some problems.

    I need from my ListView the ItemSelected with the LongPressing and Tapped Gestures. LongPressing works but without saving the ItemSelected and Tapped doesn´t works.

    This is my code:

    <ListView ItemsSource="{Binding List1}" SelectedItem="{Binding Item}"> <ListView.ItemTemplate> <DataTemplate> <mr:ViewCell LongPressing="Cell_LongPressing" Tapped="Cell_Tapped"> ....................`
    </mr:ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>

    Monday, March 2, 2015 5:09 PM
  • User57869 posted

    @zurbas

    You should also use the ListView from MR.Gestures. Like you can see in https://github.com/MichaelRumpler/GestureSample/blob/master/GestureSample/GestureSample/Views/ImageCellXaml.xaml

    Just add "mr:" to the ListView tags.

    ```

    ....................`

    ```

    Then the Cell_Tapped handler should work.

    Unfortunately the SelectedItem does not work at the same time yet. So you would have to set the Item manually in Cell_Tapped.

    Fetch the latest changes of the https://github.com/MichaelRumpler/GestureSample. I added

    • a Item property to ListOfObjectsViewModel.cs
    • SelectedItem="{Binding Item}" to ImageCellXaml.xaml
    • code to set the Item in Cell_Tapping in ImageCellXaml.xaml.cs
    Tuesday, March 3, 2015 7:54 AM
  • User82074 posted

    @MichaelRumpler with " Tapped " has not worked for me , but with "Tapping " works , thank you very much

    Tuesday, March 3, 2015 5:35 PM
  • User73752 posted

    I'm using the latest version on a android htc one s and i think the viewposition in the eventargs is not correct for this android device. Resolution 540 x 960 pixel, 256 dpi, scale 1.5 --> 360 x 640 dpi In the evenargs i got 270 x 480 dpi, are you using scale fixed with 2.0?

    Monday, March 16, 2015 8:57 AM
  • User57869 posted

    @HolgerRousselle.4906

    Yes, I do. I asked how Xamarin works with dimensions on Android in November in https://forums.xamarin.com/discussion/28131/absolutelayout-layoutbounds-units#latest

    But I didn't get an answer so I hardcoded the scale to 2. I thought thats what Xamarin.Forms expects on all devices. Where did you get your scale value from? Maybe I could use this instead?

    Monday, March 16, 2015 9:18 AM
  • User75581 posted

    is this free or ?

    Monday, March 16, 2015 9:30 AM
  • User57869 posted

    @KenKen

    It costs € 10,- per App. You can find this information at http://www.mrgestures.com/

    Monday, March 16, 2015 9:32 AM
  • User73752 posted

    I used:

    Resources.DisplayMetrics

    density=1.5, width=540, height=960, scaledDensity=1.5, xdpi=279.91837, ydpi=280.27585

    Android.Util.DisplayMetrics

    Monday, March 16, 2015 10:15 AM
  • User57869 posted

    OK, I'll use DisplayMetrics.Density in the next version. But I'm currently refactoring all the Android renderers so right now is a bad time to deploy a new version. It'll come out in a day or two.

    Monday, March 16, 2015 3:45 PM
  • User73752 posted

    Thanks. It would be nice to have a changelog for the new versions.

    Monday, March 16, 2015 3:47 PM
  • User57869 posted

    That can be found at http://www.mrgestures.com/#ReleaseNotes

    Monday, March 16, 2015 4:00 PM
  • User57869 posted

    I just released version 1.0.8. This includes some major improvements for Android. Now all events work on all elements and the Xamarin events work too at the same time.

    • [Android] handle all touch events on all elements additionally to Xamarins handlers
    • [Android] better resource management
    • [Android] use DisplayMetrics.Density instead of hardcoded 2 for calculating ViewPosition, Touches and PanEventArgs.DeltaDistance
    • [Android] don't start pan when lifting one finger after multi touch gesture

    I even placed a map within an AbsoluteLayout and I get the events from the AbsoluteLayout. This way I can see the coordinates where the user tapped on the map.

    Tuesday, March 17, 2015 4:56 PM
  • User98240 posted

    Hey, is it possible to differentiate between a tap down and up event? We would like to colorize a cell on tap down and restore the custom color on tap up.

    Friday, March 20, 2015 2:02 PM
  • User57869 posted

    @OtaMares

    Currently not, but it should be no problem to add it.

    Friday, March 20, 2015 2:19 PM
  • User98240 posted

    Oh, that would make our live so much easier. :)

    Friday, March 20, 2015 2:20 PM
  • User108406 posted

    m Chinese, I is the individual developers, each app will need to buy one? If each app to buy, then I can not afford to buy, because my app is not to make money for the purpose of, what is a good solution.

    Thursday, April 2, 2015 4:58 PM
  • User57869 posted

    @binbin.9006

    This info is on http://www.mrgestures.com/#Buy

    MR.Gestures is licensed per app name. I.e. if your app has the same name on all three platforms, you only need one license key. If you have different versions of your app (e.g. a free and a pro one) with different names, then you need a separate key for each version.

    You can use it for as many developers on as many computers as you like.

    The price for one license is EUR 10.00 (+VAT).

    So you only pay once for each app name. Even if you have many developers working on your app, you don't need a separate license key for all of them.

    After all you already payed USD 999 per developer per platform per year to Xamarin. So I do understand that you cannot afford too much for an additional component.

    Thursday, April 2, 2015 5:59 PM
  • User108406 posted

    Software name refers to what? The name of the package? To use and buy a tutorial? Only in this way to buy at a 10? I'm Chinese, and individual developers, the money is out of pocket. After the learning phase.

    Friday, April 3, 2015 4:15 PM
  • User81742 posted

    Does Mr.Gestures provide gesture recognizers that can be added to any Xamarin.Forms compliant control, or does it only work with the controls that Mr.Gestures wraps?

    Friday, April 3, 2015 4:53 PM
  • User57869 posted

    @CharlesHoran , it works only with the controls from MR.Gestures but it wraps all Xamarin.Forms controls. You can find a list at http://www.mrgestures.com/#Compatibility

    Friday, April 3, 2015 9:08 PM
  • User57869 posted

    @OtaMares @PhaseCore

    MR.Gestures version 1.1.0 has been released. This version adds the Down and Up events.

    Those events are raised when one or more fingers come down to or up from the touch screen. If the fingers do not move at the same time, then you get multiple events. Those two events use new DownUpEventArgs which include an int[] TriggeringTouches. This array holds indexes in the Touch array and tell you, which fingers came down/up. So Up is the only event, where the Touch array contains coordinates of a finger, which is not on the screen anymore.

    Unfortunately I still have a problem with the Down/Up events on iOS with the Button, Slider and Stepper. They do not work when you listen to the new events. On all other controls and the other platforms, Down+Up work as expected. See http://www.mrgestures.com/#Compatibility for details.

    This version also fixes a NullReferenceException which occured when you had an async event handler which disposed of the control it was attached to. I added a test page to the GestureSample app for this bug and it works with the new version.

    Wednesday, April 8, 2015 3:10 PM
  • User114973 posted

    Yay, Thanks you very much!

    Thursday, April 9, 2015 10:23 AM
  • User98240 posted

    Yes, thank you :)

    Thursday, April 9, 2015 10:32 AM
  • User78205 posted

    I try to add image zooming to ViewCell in ListView. It works fine in iOS. In Andriod, ViewCell pinching is mixing with ListView scrolling event and user experience in zooming is not nice. During pinching, scrolling becomes active and pinching stops. User need to pinch very carefully not to trigger scrolling. Is there any way to block ListView scrolling during view cell is pinching?

    Saturday, April 11, 2015 12:46 PM
  • User57869 posted

    I don't think that you can stop a ListView from scrolling.

    Saturday, April 11, 2015 3:19 PM
  • User113666 posted

    I'm trying to get an image to move on the screen with the panning gesture. I understood by reading this thread that in order to get the correct X and Y values I had to wrap the image in a Layout. So, I did that, and it works. And the image moves, sometimes. It stops before I have lifted my finger from the screen, even if I continuously move my finger over the screen. Sometimes it doesn't move at all when I do the panning gesture. The response I get from the pinching gesture is similar. Sometimes it works, sometimes it doesn't.

    I tried changing the ScrollView tag to StackLayout and AbsoluteLayout, but it makes no difference. It acts the same. I have only tested this on an Android device. I'm using Xamarin Forms in a PCL project. I have configured the application with a MR.Gestures registration code, so I'm getting actual X and Y values.

    Have I misunderstood how to use the gestures?

    My XAML code:

          <mr:ScrollView x:Name="wrapper" Pinching="PinchingHandler" Panning="PanningHandler" DoubleTapped="DoubleTappedHandler" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
            <mr:Image x:Name="imageHolder" Source="{Binding ImageSource}" />
          </mr:ScrollView>
    

    My code behind:

            void PinchingHandler(object sender, MR.Gestures.PinchEventArgs e)
            {
                imageHolder.Scale += 0.01;
            }
    
            void DoubleTappedHandler(object sender, MR.Gestures.TapEventArgs e)
            {
                imageHolder.Scale += 1;
            }
    
            void PanningHandler(object sender, MR.Gestures.PanEventArgs e)
            {
                var d = e.DeltaDistance;
                info.Text = "x: " + d.X + ", y: " + d.Y;
                imageHolder.TranslationX += d.X;
                imageHolder.TranslationY += d.Y;
            }
    
    Wednesday, April 15, 2015 11:04 AM
  • User57869 posted

    This looks very similar to what I did in the https://github.com/MichaelRumpler/GestureSample, just without ViewModel. You can move an image around in the ContentPage sample and a Frame in the StackLayout sample. The AbsoluteLayout and ScrollView samples do not use the PanEventArgs.

    Did you try the GestureSample? Did it work on your device?

    I think your code should work. No idea why it doesn't. Can you send me your solution so that I can try it myself?

    (The Image doesn't have to be a MR.Gestures.Image. A Xamarin.Forms.Image should suffice.)

    Wednesday, April 15, 2015 11:46 AM
  • User113666 posted

    It works when I put the image inside a RelativeLayout. For some reason I didn't try that.

    Wednesday, April 15, 2015 2:06 PM
  • User57869 posted

    I can imagine that there could be problems with a ScrollView because the pan up/down gestures could be interpreted as scrolling and therefore the DeltaDistance values may be corrupt. That would depend on how it is implemented on each platform.

    But it works for me in a StackLayout and I have no idea why it shouldn't work in an AbsoluteLayout. I didn't test the latter though.

    Wednesday, April 15, 2015 2:27 PM
  • User82074 posted

    Hello @MichaelRumpler,

    I have a ListView into a ContentPage with a ViewModel as the Context of the Page . I set the ItemSource of that list Which is an ObservableCollection of other objects . When i try to call it LongPressCommand of 1 item seems like the binding context of that item has changed to the class of the object type of the ItemSource and obviously the command cant be found.

    My code:

    ContentPage <mr:ListView ItemsSource = "{Binding List}" SelectedItem ="{Binding Item}"> <ListView.ItemTemplate> <DataTemplate> <mr:ViewCell LongPressingCommand="{Binding CellLongPressing} > <mr:ViewCell.View> ... </mr:ViewCell.View> </mr:ViewCell> </DataTemplate> </ListView.ItemTemplate> </mr:ListView> ViewModel public ICommand CellLongPressing { get; private set; } CellLongPressing = new Command<MR.Gestures.LongPressEventArgs>(...); .. Etc.

    Thursday, April 23, 2015 1:28 PM
  • User57869 posted

    @zurbas

    The BindingContext in the ViewCell is indeed one item of your List. Your CellLongPressing command therefore cannot be found.

    I use Keith Romes solution from https://forums.xamarin.com/discussion/comment/105285/#Comment_105285. This is very easy and works like a charm.

    Just add the ElementSource extension somewhere in your project and add the namspace in the header of your xaml file. Then your list would look like this:

    <mr:ListView ItemsSource="{Binding List}" SelectedItem="{Binding Item}" x:Name="theList">
        <ListView.ItemTemplate>
             <DataTemplate>
                 <mr:ViewCell  LongPressingCommand="{Binding Path=BindingContext.CellLongPressing,
                                                             Source={util:ElementSource theList}}">
                     <mr:ViewCell.View>
                         ...
                     </mr:ViewCell.View>
                 </mr:ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </mr:ListView>
    
    Thursday, April 23, 2015 2:06 PM
  • User90313 posted

    I tried the sample app found in GitHub, but it fails to launch on the iPhone simulator.

    ERR: There was an error launching the application: Failed to lookup the process ID of GestureSample after successful launch. Perhaps it crashed after launch.

    Thursday, April 23, 2015 7:59 PM
  • User90313 posted

    Never mind. I quit Xamarin Studio and the simulator, then it worked fine.

    Thursday, April 23, 2015 9:07 PM
  • User114973 posted

    Hi, I created a ListViewCell with Down/Up event.

    private void OnDown(object sender, DownUpEventArgs e)
        {
            BackgroundColor = Color.Red;
        }
    
        private void OnUp (object sender, DownUpEventArgs e)
        {
            BackgroundColor = Color.Transparent;
        }
    

    When i tap a Cell then move up/down then release (that make the listview scroll), the Up event wasn't fired.

    Monday, April 27, 2015 4:29 AM
  • User57869 posted

    @SquallLeonhart.1032

    Unfortunately this kind of stuff is handled differently on every platform. Which did you try? I'll have a look on it.

    Tuesday, April 28, 2015 6:38 AM
  • User57869 posted

    I just released MR.Gestures, version 1.2.0-pre1.

    These things changed:

    • Add support for WinPhone 8.1 and Windows Store
    • Drop support for 32 bit iOS apps
    • Two finger pan simultaneously with pinch and rotate on all platforms
    • Introduce gesture throttling on all platforms with MR.Gestures.Settings.MinimumDelta* properties
    • Add Center to all EventArgs

    This version requires Xamarin.Forms and Xamarin.Forms.Windows 1.4.3.6358-pre2.

    Please keep in mind that Xamarin.Forms for Windows is still only a preview release.

    I also had a hard time getting it to work on that platform. Unfortunately Windows Phone 8.1 swallows some events to gain better performance. I could not find a way to handle all events on all controls. See http://www.mrgestures.com/#Compatibility for details.

    I also neither have a touchscreen for my desktop computer nor a Windows tablet. So I could test all the Windows Store stuff only with the mouse. This leaves LongPress, Pinch and Rotate untested on that platform. But the code for WinPhone 8.1 and Windows Store is the same, so I do hope that it will work. Please let me know if anybody could test it on a Windows tablet or desktop.

    Tuesday, April 28, 2015 3:04 PM
  • User123821 posted

    @binbin: For learning purposes, you can download his sample app: https://github.com/MichaelRumpler/GestureSample You could change that app however you want. So you can essentially turn it into your app, for learning purposes. You just won't be able to change the name of the app ("GestureSample"), until you buy a license.

    Wednesday, April 29, 2015 11:50 AM
  • User123821 posted

    (My company purchased a license to MR.Gestures today, and it is working for us, on both Android and iOS.)

    Wednesday, April 29, 2015 11:52 AM
  • User74961 posted

    Hi @MichaelRumpler I'm trying to implement swipe functionality in ListView cell on Android and ios to reveal some buttons when user swipes a cell. Can I do this with MRGestures? I see that it has Swiped event, but I probably will need to have some animation during the swipe and there is no "Swiping" event.

    Sunday, May 3, 2015 7:09 AM
  • User57869 posted

    Hi @G1V2

    A swipe is a pan where the last finger which leaves the screen was still moving fast enough when it was lifted. So you cannot know if it was a swipe or pan until the last finger left the screen. As long as a finger is down and moving you get Panning events and when it leaves the screen, you either get Swiped (if the finger still moves fast enough and Swiped is handled) or Panned.

    For your use case though, check out if the ContextActions are enough. On iOS they do exactly what you want. Unfortunately Xamarin thinks that the standard gesture to show the ContextActions on Android is a long tap. If your client thinks the same way, you could go with that and you wouldn't have to do any custom animation.

    Sunday, May 3, 2015 8:27 AM
  • User74961 posted

    @MichaelRumpler Thanks for the quick answer. I think panning event is what I looked for. Unfortunately I need swipe on both platforms, so ContextActions are not good enough. On iOS it's almost there, but I need buttons with icons, while ContextActions support icons for MenuItem only on Android. Do you have any example implementing such animation?

    Sunday, May 3, 2015 8:41 AM
  • User57869 posted

    @G1V2

    No, sorry. I didn't do that yet.

    Sunday, May 3, 2015 9:04 AM
  • User114973 posted

    @MichaelRumpler

    It happened on Android, iOS has no problem.

    I have a 100 records ListView, - I Tapdown, the Down event fired => Cell change color. - Move my finger to make the ListView Scroll - Then i release, the Up event not fired.

    Monday, May 4, 2015 7:44 AM
  • User57869 posted

    @SquallLeonhart.1032

    I added it to my todo list. But unfortunately I have to continue work on my app now. I worked on the Windows platform of MR.Gestures for the last two weeks and got behind schedule with the app. So don't expect anything in the next two weeks.

    Monday, May 4, 2015 8:28 AM
  • User78421 posted

    @MichaelRumpler Hello! I am using the siwpe feature of MR.Gestures, but it picks up every swipe Direction as "Not Clear". Is it just really sensitive? Do you think it is the phone's issue? Thanks!

    Thursday, May 7, 2015 10:31 PM
  • User57869 posted

    @CodyRousseau Then the LicenseKey does not match the app name. See the FAQs.

    I will throw an exception if these do not match in the next version.

    Friday, May 8, 2015 6:28 AM
  • User114973 posted

    @MichaelRumpler The event Tapping and LongPressed aren't work too. Can't find any temporary fix. Have to disable the Up/Down event on ViewCell and wait for fix.

    Friday, May 8, 2015 8:26 AM
  • User57869 posted

    @SquallLeonhart.1032

    Are you still talking about scrolling a ListView? Tapping and LongPressed are not raised during a pan. For other elements see http://www.mrgestures.com/#Compatibility. Everything should work on Android.

    Friday, May 8, 2015 8:48 AM
  • User78421 posted

    @MichaelRumpler I have another question: How come the swipe doesn't detect listview.ItemSelected? Is it something that you are working on for the next update?

    Friday, May 8, 2015 9:05 PM
  • User57869 posted

    @CodyRousseau you mean the mr:ListView does not raise ItemSelected? Yes, that is an open issue. It seems like some gestures on some platforms cannot be handled by me and Xamarin at the same time. But you can bind to SelectedItem instead. This works on all platforms.

    Saturday, May 9, 2015 2:23 PM
  • User121730 posted

    @MichaelRumpler I have bought licence to your gesture control and it works great, Now what I am tring to do is show up an image , add events like double tap to it for it to zoom , and move the image around the container, now double tapping it should get it back to the same size and the same location as it was earlier in the container, though it dosent seem to do that, I had a look at your sample on github and coudent find much help there either.

    Sample code

            <?xml version="1.0" encoding="utf-8" ?>
            <mr:ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                         xmlns:mr="clr-namespace:MR.Gestures;assembly=MR.Gestures"
                         x:Class="ECS.Intranet.Mobile.View.ContentPageXaml"
                         Title="ContentPage Sample"
                             TappingCommand="{Binding TappingCommand}"
                            TappedCommand="{Binding TappedCommand}"
                            DoubleTappedCommand="{Binding DoubleTappedCommand}"
                          PanningCommand="{Binding PanningCommand}"
                            PannedCommand="{Binding PannedCommand}"
                            SwipedCommand="{Binding SwipedCommand}"
                            PinchingCommand="{Binding PinchingCommand}"
                            PinchedCommand="{Binding PinchedCommand}">
    
                <Grid>
                <Grid.RowDefinitions>
                  <RowDefinition Height="45" />
                  <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                   <ColumnDefinition Width="*" />
               </Grid.ColumnDefinitions>
              <StackLayout Orientation="Horizontal" Grid.Row="0" Grid.Column="0">
                        <Button Command="{Binding AddCharCommand}" BackgroundColor="Transparent" Image="back.png"  CommandParameter="5"/>
                        <Picker x:Name="pagePicker" VerticalOptions="Center" WidthRequest="60"></Picker>
              <Label Text="{Binding TotalPage}" FontSize="18" VerticalOptions="Center"/>
              </StackLayout>
              <RelativeLayout Grid.Row="1" Grid.Column="0">
    
                <ContentView Padding="2" BackgroundColor="Black" 
                            RelativeLayout.XConstraint="{ConstraintExpression Type=Constant, Constant=0}"
                            RelativeLayout.YConstraint="{ConstraintExpression Type=Constant, Constant=0}"
                            RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width}"
                            RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height,,Factor=0.90}">
    
                  <Image Source="{Binding ImageSource}" 
                               Scale="{Binding Scale}"
                               TranslationX="{Binding TranslationX}"
                               TranslationY="{Binding TranslationY}"
                               AnchorX="{Binding AnchorX}"
                               AnchorY="{Binding AnchorY}"
    
                               />
                        </ContentView>
    
                <ActivityIndicator IsRunning="{Binding IsBusy}" IsVisible="{Binding IsBusy}" 
                                          RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent,
                                                    Property=Height,
                                                    Factor=0.33}"
                                           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent,
                                                    Property=Height,
                                                    Factor=0.33}" />   
                </RelativeLayout>
              </Grid> 
            </mr:ContentPage>
    

    All i do Now is on the event is

    protected override void OnDoubleTapped(MR.Gestures.TapEventArgs e)
            {
                base.OnDoubleTapped(e);
                if (this.scale != 1)
                {
                    Scale = 1;
                }
                else {
                    Scale = this.scale + 0.5;
                }
    
            }
    

    So the double tap will resize my image but tapping it back resets it back to the same scale but not at the same location it was initially.

    Wednesday, June 10, 2015 4:35 PM
  • User57869 posted

    @Lokesha

    Glad that you like it.

    You need to reset TranslationX and TranslationY too to move the image back to its original location.

    Also be careful about the line

    if (this.scale != 1)
    

    scale is a double, so comparisons like == or != may not work as expected. You should rather write

    if (Math.Abs(this.scale - 1) < 0.0001)   // or another very small value
    
    Thursday, June 11, 2015 6:14 AM
  • User73426 posted

    I can't seem to make it work, I'm trying to make a simple tapped gesture, but my event is not called, do I need to buy the license in order for this to work?

    MR.Gestures.StackLayout favStack = new MR.Gestures.StackLayout () { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, Padding = new Thickness(5,5), Children = {favIcon, favLabel} }; favStack.Tapped += (s, e) => { Debug.WriteLine("Code: Red Tapped"); };

    Tuesday, June 16, 2015 9:28 PM
  • User73426 posted

    Nevermind, I tried other Gestures like Up, Down and Tapping; and they worked, though I don't know why Tapped is not working.

    Tuesday, June 16, 2015 10:14 PM
  • User57869 posted

    @LuisN

    Tapped is only raised in my internal Tapping handler, when TapEventArgs.NumberOfTaps equals 1. Similarly DoubleTapped is only raised, when it is 2.

    When you have no license, then all properties of the EventArgs will remain at their defaults (i.e. 0), so Tapped and DoubleTapped will only be raised when you use a valid LicenseKey.

    You can always add your code to the GestureSample, or you could even temporarily rename your own app to "GestureSample" and use its LicenseKey.

    Wednesday, June 17, 2015 5:52 AM
  • User123358 posted

    Hi @MichaelRumpler,

    I would like to access the color information of the pixel tapped on an image. I don't think it's possible in your plugin as for now, do you think it could be in future version ?

    Regards.

    Thursday, June 18, 2015 4:07 PM
  • User57869 posted

    @PhilippeLEROY

    You get the coordinates of all touching points in the property Touches of the event args. See mrgestures.com/#EventArgs. With these coordinates you can look up in your image, which color the pixel at that position has.

    However, a finger always touches more than one pixel, so this cannot be very accurate.

    Thursday, June 18, 2015 4:32 PM
  • User123358 posted

    @MichaelRumpler Thanks for your quick reply. I don't think that your solution could work in my case, the image could be resize using pinch. So when tapping on it, the coordinates on the screen may be not the same as the coordinates on the image. Do you think of another solution ?

    Friday, June 19, 2015 8:08 AM
  • User57869 posted

    @PhilippeLEROY

    But you know, how your image has been scaled, translated and rotated. You have all the data you need to calculate the coordinates within the image.

    What you need is a side case which nobody else but you will ever want. I don't know, how to do it. It is not related to gesture recognition. So I will not add it to my library. Sorry.

    Friday, June 19, 2015 8:17 AM
  • User123358 posted

    @MichaelRumpler Yes i understand that it's not really a usual usecase of your plugin. I'm gonna try an other way to do what i want but i will use your plugin to get the coordinates of the tap anymay.

    Friday, June 19, 2015 8:28 AM
  • User16595 posted

    @MichaelRumpler Is there or will there be a way to see if a "NotClear" swipe is more left or more right? It would be great when the touch coordinates of the "first touch" would be accessible so we could check that on our own. :)

    Sunday, June 21, 2015 11:49 PM
  • User57869 posted

    @Maru

    You only get the Direction in the SwipeEventArgs. However, there will be Panning events as long as the finger moves on the screen. So you could remember the last PanEventArgs in the Panning event and then check its Velocity in the Swiped event. In PanEventArgs.Velocity you get X and Y values.

    The coordinates of the first touch are sent to you in the Down event (won't be much different than in the first Panning).

    Monday, June 22, 2015 6:04 AM
  • User120969 posted

    I'm having issues with this library. Using the Image with a TappedCommand. The tappable area seems to be only on the left side of the image. In portrait mode this is largely fine, but when running in Landscape taps do not register 99.9999% of the time. If you very delicately tap the extreme left edge of the Image it might decide to register

    This happens on both the emulator (standard 10 inch tablet profile) and a Nexus 10 device running 4.4.3.

    Any help appreciated.

    Thursday, June 25, 2015 3:39 PM
  • User57869 posted

    @Matthew.4307

    I also have a Nexus 10, but I don't see this behavior. Could you please try the GestureSample and see if this happens there too? Or do you maybe have any other elements overlapping the Image?

    Thursday, June 25, 2015 4:15 PM
  • User120969 posted

    I'll have a look at the sample tomorrow, but I've included a screenshot that shows my ViewCell which exhibits the issue.

    The blue boxes represent cells in a single row Grid. The Image is in the final Grid Column which is set as "Auto" width and height. The red line indicates the area of the image that seems to respond to the tap event in landscape mode.

    The image is square, though anything that isn't grey is transparent, but that shouldn't be an issue.

    This ViewCell is used inside a standard Xamarin ListView

    Thursday, June 25, 2015 5:49 PM
  • User120969 posted

    It looks like your library is fine and there is some bug with the Master Detail Page. I turned on layout outlines and created a Master Detail Page with a blue Master and green Detail. You'll notice a layout line by the edge of the Detail. Unfortunately this is stealing the tap events and just happens to be where my image is.

    UPDATE> It's possible that there is a scollbar responsible for this dead spot. So presumably a MasterDetailPage includes a scrollview for the Detail and allocates ~60 pixels on the right side for it.

    Thursday, June 25, 2015 6:47 PM
  • User57869 posted

    @Matthew.4307

    Could you please send me a demo project. Then I'll try to find a workaround.

    Friday, June 26, 2015 6:07 AM
  • User53292 posted

    Is there any successful code sample available for implementing zoom on Image Pinching? The sample seemed to have this commented out, and I didn't see any implementation.

    Monday, July 6, 2015 3:39 PM
  • User37137 posted

    @KeithRowe

    Just bind the image to scale properties in a viewmodel, and for the parent object of the image (ie the layout) set up some on pinching and onpinched which modify the scale by the deltapinch

    Monday, July 6, 2015 4:01 PM
  • User57869 posted

    @KeithRowe

    The sample for the ContentPage in the GestureSample does exactly that. It handles the gestures on the ContentPage and shows an image which can be zoomed, rotated and dragged using the Pinching, Rotating and Panning gestures respectively.

    Tuesday, July 7, 2015 6:44 AM
  • User57869 posted

    @SquallLeonhart.1032

    Sorry for not responding for so long. The problem turned out to be more complicated than I thought. It turns out that that's how Android handles the gestures. If you tap a cell, I raise the Down event of that cell. If you now move your finger up or down, then the ListView intercepts the gesture. This means that the gesture gets cancelled for the cell and the ListView receives all subsequent events. The cell is not informed of these anymore and so I cannot raise Up.

    I'll keep it on my todo list. Maybe I can find a workaround for it.

    Tuesday, July 7, 2015 3:43 PM
  • User114973 posted

    @MichaelRumpler I need change the cell color to green if tap down and return to white when release. If you find any workaround please let me know. Thanks.

    Wednesday, July 8, 2015 2:45 AM
  • User57869 posted

    @SquallLeonhart.1032

    You could listen to the Up event of the ListView and change the color of all cells back to white when that occurs.

    Wednesday, July 8, 2015 8:11 AM
  • User53292 posted

    @MichaelRumpler - Thanks for all your help on this. I got the sample working, but cannot port it over to my project.

    Attached are: - GestureSamplePinch - a version of your gesture sample with simply one screen, an image with OnPinching implemented - SampleAppWPinching - a sample app I am working on, that has the exact same code ported over but the OnPinching does not get called

    I have followed the installation instructions precisely, and the license says it isvalid after the license key is applied. I changed the app name in Windows Store to GestureSample - does it do follow up matching with the DLL or anything?

    Wednesday, July 8, 2015 1:32 PM
  • User37816 posted

    Just a non-tech question. Why didn't you release this on the Xamarin Component store? Due to the per-app licensing? Or was there any other factor that you didn't like?

    Wednesday, July 8, 2015 1:53 PM
  • User57869 posted

    @GaborFuredi

    Because the Xamarin Component Store cannot handle PCL projects. And thats the whole point of Xamarin Forms.

    I wanted to put it on the component store, but when I found out that they cannot do it and they didn't answer my email (still waiting for an answer to that mail from November), I started to think about a different licensing model.

    They still cannot do it. When I look at the DevExpress Grid for example, you have to add the component to each platform project separately and then add a reference to the PCL project manually. It is much easier to just open "Manage NuGet Packages for Solution", select one package and install it to all projects automatically at the same time. So NuGet was the way to go. After all, thats also what James Montemagno advocates here and here.

    Thursday, July 9, 2015 8:44 AM
  • User115187 posted

    I bought this today and it's working great, very impressive library Michael!

    Thursday, July 9, 2015 9:03 AM
  • User57869 posted

    @KeithRowe

    In your sample solution the project "SampleCarousel.WinPhone" is for Windows 8.1 and not Windows Phone 8.1. And I get two errors when I try to compile:

    Could not find SDK "Microsoft.PlayerFramework.Xaml, Version=2.0.0.0".
    Could not find SDK "SQLite.WinRT81, Version=3.8.10.2".
    

    Could you please fix those.

    I don't have a touchscreen for my PC, so I cannot test the multitouch gestures on Windows 8.1. I can only test on WinPhone 8.1. They do share most of the code, so I do assume that it works on Windows when it works on WinPhone, but I can't be 100% sure.

    Thursday, July 9, 2015 9:24 AM
  • User53292 posted

    @MichaelRumpler - Thank you for your help. I am now working on a different machine, and things seem to be working. I don't wonder if some of the issues are from working on a relatively immature Xamarin-WinStore combo. I'll let you know as I run into any more issues. Thanks again for all your help. For anyone wondering whether to buy, I strongly recommend given the good tech support and the troubles of writing custom renderers to handle these things without it.

    Thursday, July 9, 2015 12:23 PM
  • User37816 posted

    @MichaelRumpler thanks for the info, very interesting!

    Thursday, July 9, 2015 2:11 PM
  • User57869 posted

    I finally released the new version 1.2.0 a few minutes ago.

    This is the first release version with Windows Runtime support. It runs much smoother now compared to 1.2.0-pre1. It does not break anything anymore like pre1 did (scrolling did not work sometimes).

    This version is built upon Xamarin.Forms.1.4.3.6374 which also means that the Xamarin.Forms.Windows dependency is not needed anymore.

    If you have custom renderers on your own, then you don't need to inherit from mine anymore. It is now much easier to add the gesture functionality to your own renderers.

    Friday, July 17, 2015 1:42 PM
  • User57869 posted

    Somebody sent a tweet with a bug yesterday. On Android, if you used a MR.Gestures.ScrollView with Orientation="Horizontal", then it wouldn't scroll. A normal Xamarin.Forms.ScrollView worked as expected.

    I fixed that bug and released version 1.2.1. I also updated the GestureSample and added a test page there. It can be found in the app in Tests / Horizontal ScrollView.

    Wednesday, July 22, 2015 7:21 AM
  • User55052 posted

    @MichaelRumpler I purchased a license for your Gestures package, but I used the project name instead of the app name by accident, so now I am unable to use it. Is there a way I can have that fixed?

    Thanks

    Rody

    Wednesday, August 5, 2015 12:27 PM
  • User57869 posted

    @Rody

    I sent the new license key to your azure mailbox.

    Wednesday, August 5, 2015 1:03 PM
  • User55052 posted

    @MichaelRumpler Thank you very much for the quick reply. It is working perfectly now. Excellent work with this package!

    Wednesday, August 5, 2015 1:17 PM
  • User2086 posted

    @MichaelRumpler I seem to be having an issue with pinching on an image to zoom in and out of it. The actual pinching is very erratic and can even adjust the scale between extremes (e.g. going from 0.5 to 1.9 in a tiny finger movement).

    The same behaviour is visible in the GesturesSample app, on the ContentPage sample. In the simulator, just hold option and move the mouse up and down. Instead of being a small scale difference, it bounces around (though the rotation in the sample seems to mask the behaviour some what).

    Any idea what's going on there? In my code, I am using what it does in the sample app and experiencing the same problem (and it's more noticeable on an actual device).

    Friday, August 7, 2015 4:03 PM
  • User53292 posted

    @MichaelRumpler - When I implement a swipe gesture on a scroll view, the scrollview overrides the swipe (i.e. I am trying to implement a carousel view in a Windows Store app, and swipe should go from view to view but it doesn't because it scrolls the screen). Is there any way to override the scrollview with the swipe gesture?

    Friday, August 7, 2015 7:10 PM
  • User57869 posted

    @cleardemon

    I don't see that behavior in the ContentPage sample and nobody else reported that either. Which device are you using / simulating?

    Saturday, August 8, 2015 12:52 PM
  • User57869 posted

    @KeithRowe

    Unfortunately that's a limitation of the ScrollViewer on Windows runtime. Rob Caplan explained that in his blog at http://blogs.msdn.com/b/wsdevsol/archive/2013/02/16/where-did-all-my-gestures-go.aspx and I also have some information about it at http://www.mrgestures.com/#Compatibility

    Saturday, August 8, 2015 1:03 PM
  • User33230 posted

    Not sure if this is the right place . . .

    @MichaelRumpler - I use MR Gestures and love it. However with left swipes the new iOS functionality considers that to be a back navigation. Is it possible to disable that for a page, or especially for a MR control. I.E. if the swipe is in my MRStackLayout container, don't let the OS consider it a navigation event?

    Wednesday, August 12, 2015 1:13 AM
  • User57869 posted

    @MathiesonSterling

    I did plan to use the Handled flag in the EventArgs for that. A gesture handler would set the flag to true to indicate that it would solely be responsible to handle the gesture. Unfortunately I couldn't get it to work reliably on all platforms.

    Some elements need to handle gestures themselves to work properly. Depending on the native implementation they could suppress the gesture events being forwarded to my library. One example for that is the swipe which is used for navigation also within a MasterDetailPage or the ScrollViewer in a Windows Runtime app (mentioned just 2 posts above).

    I always tried to keep existing functionality working. This means that my gesture handling works in parallel to any other gesture handling of other elements. As the Handled functionality does not work, I cannot suppress the gesture events to be forwarded to any other elements.

    Wednesday, August 12, 2015 9:18 AM
  • User33230 posted

    Thanks for the quick response @MichaelRumpler - I'll look more into the iOS side then and see if can be disabled easily there.

    Wednesday, August 12, 2015 7:15 PM
  • User68697 posted

    Probably a dumb question but I am using ContentPages with StackLayouts and am currently displaying an Image in one of the StackLayouts. I have the out of the box TapGestureRecognizer wired up to the Image and it works fine but I need to know what part of the image the user has touched (x&y) ...will MR.Gesture provide that functionality? I have looked at the sample code but I'm not using XAML or ViewModels. Thank!

    Thursday, August 13, 2015 4:55 PM
  • User57869 posted

    @JamesCGalindo

    The TapEventArgs (and all other EventArgs) have a property called Touches. This is an array of Point which gives you the coordinates of all fingers currently touching the screen. See http://www.mrgestures.com/#EventArgs.

    You can add simple event handlers in code too. This is described here.

    Friday, August 14, 2015 8:56 AM
  • User150032 posted

    Panning the element only inside of its parent

    Referring MR.Gestures samples, we can move the element all over the screen using the "PANNING" event. And I tried to move the element only inside the parent block / element, but didn't got any luck. For example,

    Image 1 & 2 are the mr:Image with panning event. "Image 1" should move only inside of "Cell 1", currently we can move the "Image 1" inside "Cell 2" also. I tried to use the image inside with RelativeLayout and AbsoluteLayout. But still the image Overlapping in both Cells. Is there any way to move element only inside of its parent element?

    Friday, August 14, 2015 12:50 PM
  • User62326 posted

    @MichaelRumpler do you have some code examples for your library and how to use it without inheritance to your base classes ?

    Friday, August 14, 2015 12:59 PM
  • User57869 posted

    @Optimus07

    When you start the gesture within Cell1, then the Panning events will be forwarded to the Cell1 handler until the gesture is over. You have to check the coordinates of PanEventArgs.Touches to decide whether to move the image.

    @AndriyTsok

    No, I still have to add those to the GestureSample. Didn't have the time to do it and there was no request for it yet. In the attached zip you can find my implementation of the BoxView and the renderers for all platforms. If you implement your own element like that, then it should work.

    Friday, August 14, 2015 1:27 PM
  • User2086 posted

    @MichaelRumpler Cheers for responding, just got around to responding myself.

    I have created a simple test app that demonstrates the problem. Open the solution in XS, and set the Application Name under the iOS project to something that works with a license key, and set the actual license key in AppDelegate.

    Run the app in the simulator and a photo of a bird will appear. Hold option and click and drag over the image. It should scale up and down very erratically!

    ZoomableImage is the custom class that inherits from MR.Gestures.Image that simply adds event handlers to Pinching and Panning. I'm pretty much using code I copy-pasted from the GesturesSample app.

    Any thoughts on this one?

    Friday, August 14, 2015 2:41 PM
  • User57869 posted

    @cleardemon

    When you change the Scale during a gesture, then the touch coordinates cannot be calculated correctly. This same problem also exists when you do everything native without MR.Gestures. You should always add your gesture handlers to a container which will not be modified and change the Scale/Rotation/Translation of a subview only.

    You said in your previous post, that you have problems in the GestureSample too. Is this correct? If yes, then you need to tell me on which devices/simulators you got errors.

    Tuesday, August 18, 2015 5:11 PM
  • User147303 posted

    Hello All, I m moving a frame by using Panning gesture of MR Gesture,It's working but while panning it's blinking a lot.Doeas anybody know why this is happening.here is my panning event and view:

    Event: void Card_Panning(object sender, MR.Gestures.PanEventArgs e) { var deltax = e.DeltaDistance.X; var deltay = e.DeltaDistance.Y; try{

            //DisplayAlert ("panning", "panning called", "OK");
            var d = e.DeltaDistance;
            //info.Text = "x: " + d.X + ", y: " + d.Y;
            topCard.TranslationX += d.X;
            topCard.TranslationY += d.Y;
            }
            finally{
                //topCard.TranslationX = deltax;
                //topCard.TranslationY = deltay;
            }
        }
    

    topCard is the name of my mr:Frame control

    Thursday, August 20, 2015 1:24 PM
  • User57869 posted

    @binayyadav

    It's the same answer I gave the previous poster.

    When you change the Scale during a gesture, then the touch coordinates cannot be calculated correctly. This same problem also exists when you do everything native without MR.Gestures. You should always add your gesture handlers to a container which will not be modified and change the Scale/Rotation/Translation of a subview only.

    So handle the Panning event in a container of topCard then it should work.

    Thursday, August 20, 2015 2:05 PM
  • User147303 posted

    @Michael Thanks man..It worked for me :)

    Friday, August 21, 2015 6:49 AM
  • User149622 posted

    Hello Michael

    I hope to buy MR.Gesture. So, I tried it and payment is completed successfully, but I can't find the my key anywhere. Kindly help me. My email is luying.zhen@yandex.com

    Saturday, August 22, 2015 1:19 PM
  • User149622 posted

    Hello Michael

    How can I receive the key of my app? What can I do?

    Saturday, August 22, 2015 1:31 PM
  • User57869 posted

    Usually the key is printed on the web site and sent to you via email after the payment is completed. But the company who processes the payment and issues the license keys has problems with Chinese characters. I already told them months ago and they claimed to have fixed it. Unfortunately this seems to be wrong.

    However, I created and sent you your license key manually. I will also ask DigitalRiver to check their unicode processing again.

    Monday, August 24, 2015 11:26 AM
  • User57869 posted

    I released version 1.2.2 of MR.Gestures.

    When you handled Panning, but not Panned, Pinching without Pinched or Rotating without Rotated, then the gestures were not properly ended and reset. Therefore when the next gesture started, the first EventArgs included some weird Delta* values. This has been fixed now.

    Sunday, August 30, 2015 10:04 AM
  • User151047 posted

    Thanks.. It helped me lot

    Thursday, September 3, 2015 2:14 PM
  • User151047 posted

    Does it has any problem for Xamarin.Winphone? When i am registering it with MR.Gestures.WinPhone.Settings.LicenseKey = "Key"; it gives exception An exception of type 'System.ApplicationException' occurred in MR.Gestures.WinPhone.DLL but was not handled in user code

    Additional information: The LicenseKey 'KEY-Key-Key..' is not for the app 'AppName.WinPhone'.

    One more thing, same key works for Android, iOS.

    Friday, September 4, 2015 10:02 AM
  • User157648 posted

    I've got the velocity value from a swipe gesture. Anyone know a lib / class that acts as "velocity decelerator" ? To implement your own scrollviewer-like control ? It should send events in short intervals (e.g. every 20 ms) and provide the new velocity value (whose absolute value gets smaller each time)

    Saturday, September 12, 2015 10:38 AM
  • User157648 posted

    a decay animation functionality ?

    Saturday, September 12, 2015 11:45 AM
  • User157648 posted

    Finally I found a solution using View.Animate e.g.

    this.Animate(name: animationHandle, callback: callback1, start: velocityY, end: 0.1, length:3000, easing: Easing.CubicOut, finished: finishedDecay);

    Saturday, September 12, 2015 4:48 PM
  • User57869 posted

    I just released MR.Gestures 1.2.3.

    It is compiled with Xamarin.Forms 1.5.0.6446 and must be used in your WinPhone projects if you use XF 1.5.*.

    There are no code changes in this version.

    Friday, September 18, 2015 10:18 AM
  • User120541 posted

    @MichaelRumpler

    I was just wondering if you were thinking about supporting 3D touch anytime in the future. I think it might be a nice premium feature that people might pay a bit extra for. I know I would.

    Thursday, September 24, 2015 8:13 PM
  • User28549 posted

    @KestonCrandall since this is a Forms project, what would the 3D touch equivalent look like on Android and WinPhone? Does it still fit the cross-platform paradigm.

    Thursday, September 24, 2015 9:10 PM
  • User120541 posted

    @ChaseFlorell It wouldn't be a cross platform feature obviously. It would something you would use coditionally with iOS in your shared code with MR.Gestures.

    Thursday, September 24, 2015 10:11 PM
  • User110916 posted

    HI MR, I've used your product to working in my project. It works like a charm with mouse mode in the simulator, but it's not working with touch mode in the simulator and the real device also. Could you please suggest me anything in this case? P/S: My app is built on windows 8.1 platform. And I used Swipe and panning gestures to catch all action of swipe to right or left.

    Friday, September 25, 2015 4:08 AM
  • User57869 posted

    @KestonCrandall @ChaseFlorell 3D Touch is available in the Android API for ages (even though it does not work on all devices). The Windows Runtime API includes it too. They just didn't use it. Maybe this will change now that Apple does. So multiplatform support wouldn't be a big problem. I will add it, but currently I have no time for it. I have to release my own app before I go on vacation for 4 weeks. I'll be coming back in the 2nd week of November and will hopefully have time to do more on MR.Gestures by mid of November.

    @ANDO Sorry to hear that. As I already stated on my web page:

    I do not have a multitouch device (Windows tablet or touchscreen for the desktop) to test Windows Store apps. I could only test the single touch gestures with the mouse. LongPress does not work with the mouse at all. I suppose it really needs to come from a touch device. For that reason Windows Store apps are missing in the following table. I cannot tell you what works and what doesn't, unless I can test it on a real device.

    Windows Phone 8.1 and Windows 8.1 both use exactly the same code. So I really don't know, why it works on the phone, but not on the desktop. Unfortunately there's nothing I can do about it until I got my own touchscreen for the PC - which is not planned unless one of my monitors breaks. And to be honest, the Universal Windows Platform is more important, than Windows Runtime. If it runs on UWP, but not on runtime, then that's how it will be. I also won't put any effort in WinPhone Silverlight anymore.

    Friday, September 25, 2015 6:20 AM
  • User110916 posted

    @MichaelRumpler: Thanks for ur reply. I solved that problem, your gesture works correctly in Win RT and real device.

    But today, I got an issue. This is my log for this issue:

    Message: Value does not fall within the expected range. Stack trace: at Windows.UI.Input.GestureRecognizer.ProcessDownEvent(PointerPoint value) at MR.Gestures.WinRT.WinRTGestureHandler.OnPointerPressed(CoreWindow sender, PointerEventArgs ev).

    It's just occur only one time, but It's cause my app crash. I wondering that it can occur again in using time however I can not replicate it :persevere: So, could you provide me which way for this case happen?

    Thursday, October 1, 2015 2:36 PM
  • User57869 posted

    @ANDO I'm glad that it works on WinRT too. I couldn't find why ProcessDownEvent would throw an exception, but I added a try/catch around all calls to the Windows.UI.Input.GestureRecognizer. It will be included in the next version.

    Friday, October 2, 2015 3:38 PM
  • User79172 posted

    Hi @MichaelRumpler

    I have just bought and attempted to implement your touch handlers in a new IOS Forms project. I copied the bare-bones Xaml, putting the commands for the gestures on the ContentPage, and implementing them in the ViewModel.

    When I run it on my device, it works fine. However, the Simulator doesn't raise any of the events.

    Is there something special I need to do to make this work in the Simulator?

    Tuesday, October 6, 2015 1:48 PM
  • User57869 posted

    @KrisAdams nothing I'm aware of.

    The GestureSample runs without problems in my iPhone5 iOS 9 simulator. Did you try that?

    Tuesday, October 6, 2015 2:08 PM
  • User79172 posted

    Well I don't know if it works. When extracting the sample, opening it in Xamarin and trying to run I get this:

    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: Error: No installed provisioning profiles match the installed iOS code signing keys. (GestureSample.iOS)

    Tuesday, October 6, 2015 2:18 PM
  • User79172 posted

    @MichaelRumpler I still couldn't get your sample to work, but I got my own project to work.

    I think it was a bug somewhere in Xamarin / Simulator. I switched it to iPad, ran it, then switched it back to iPhone and now the events are being caught.

    Super weird.. But nothing wrong from your side. Cheers.

    Tuesday, October 6, 2015 2:49 PM
  • User57869 posted

    I just released MR.Gestures 1.2.4.

    This changed:

    • Reset panning gesture on swipe

    When you handled Swiped and Panning, then the Panning gesture was not properly reset after a swipe. On WinPhone Silverlight this could result in a NullReferenceException. On the other platforms, the PanEventArgs.DeltaDistance had weird values in the first Panning event.

    • [WinRT] fix a bug with elements on TabbedPage / CarouselPage

    If you had elements on different subpages of a TabbedPage or CarouselPage and those elements were at the same screen positions, then the gestures were raised also for elements which were currently not visible.

    • [WinRT] try/catch around calls to Windows.UI.Input.GestureRecognizer

    This is just a precaution for the exception @ANDO reported above. It is not reproducible, but a try/catch does no harm.

    Message: Value does not fall within the expected range. Stack trace: at Windows.UI.Input.GestureRecognizer.ProcessDownEvent(PointerPoint value)

    On my TODO list for the next version:

    • Windows 10 (UWP) support
    • hand back the pressure of each touch

    I will go on vacation on Sunday. My wife and I will do a round-trip through Laos for four weeks. I do plan to check on my emails, but I don't know how well the internet connection will be there.

    Don't break anything. :wink:

    Wednesday, October 7, 2015 1:14 PM
  • User79172 posted

    @MichaelRumpler Does your Gestures class work in an IOS app? I want to use it instead of the built in gesture recognizers.

    Saturday, October 10, 2015 3:26 PM
  • User53292 posted

    When you say you are looking to implement "Windows 10 (UWP) support" does this mean things are not working on Windows 10 now? I have gotten some concerns about people using the swipe in a carousel I built on Surface 3s, and am just curious if this is a Windows 10 issue.

    Thursday, October 15, 2015 1:12 PM
  • User53292 posted

    Never mind - issue was that I changed the name of the app for the client. Is there a way to change the App Name in your registration?

    Friday, October 16, 2015 2:20 PM
  • User32870 posted

    @MichaelRumpler Hi Michael, I just bought a licence but I have some problems with WP and Android. I also use XLabs in my app and I can't get the IoC to work properly icw MR.Gestures. iOS works fine. Are there any known issues with this?

    Friday, October 16, 2015 8:23 PM
  • User2122 posted

    @MichaelRumpler -

    Sorry to bother you but I believe I am in need of your help. I am trying to use Mr.Gestures to track the panning gesture of a Xamarin.Forms AbsoluteLayout while a long press gesture is active. On iOS, I can detect a pan gesture while long pressing (very awesome). However, on Android no pan gestures are fired during a long press. Here is the class where all of the action is occurring:

    ``` using System; using Xamarin.Forms; using System.Collections.Generic; using System.Collections; using System.ComponentModel;

    namespace FormsMod { public class MyView : MR.Gestures.AbsoluteLayout { #region Constructor public MyView() { this.LongPressed += OnLongPressed; this.LongPressing += OnLongPressing; this.Panning += OnPanning; } #endregion

        #region Gestures
        public void OnLongPressing(object sender, MR.Gestures.LongPressEventArgs e) {
            System.Diagnostics.Debug.WriteLine(GetType() + ".OnLongPressing:"+this.ToString()+" duration:"+e.Duration+" center:"+e.Center+" touches:"+e.NumberOfTouches+" viewPosition:"+e.ViewPosition);
            System.Diagnostics.Debug.WriteLine (" ");
        }
    
        public void OnLongPressed(object sender, MR.Gestures.LongPressEventArgs e) {
            System.Diagnostics.Debug.WriteLine(GetType() + ".OnLongPressed:"+this.ToString()+" duration:"+e.Duration+" center:"+e.Center+" touches:"+e.NumberOfTouches+" viewPosition:"+e.ViewPosition);
            System.Diagnostics.Debug.WriteLine (" ");
        }
    
        public void OnPanning(object sender, MR.Gestures.PanEventArgs e) {
            System.Diagnostics.Debug.WriteLine(GetType() + ".OnPanning:"+this.ToString()+" delta:"+e.DeltaDistance+" total:"+e.TotalDistance+" touches:"+e.Touches+" viewPosition:"+e.ViewPosition);
            System.Diagnostics.Debug.WriteLine (" ");
        }
        #endregion
    }
    

    } ``` Do you have any recommendations to help with this? Thank you for your consideration.

    Monday, October 19, 2015 4:44 PM
  • User2122 posted

    FYI: Here's a StackOverflow article that talks to how to work around this issue when dealing with it natively:

    http://stackoverflow.com/questions/5651082/move-events-after-longpress

    Monday, October 19, 2015 7:17 PM
  • User40046 posted

    @MichaelRumpler I just purchased a copy of your controls. They are working perfectly on iOS, but I can't seem to get the resgistration working on Android. I've had to change the name of the android project and have cleaned the solution and rebuilt the project. Yet, it is still displaying a notice that the license code is not appropriate for the app.

    The obvious checks: I've ensured the name of the application is copied directly from the iOS application that works. The application name is located in the Activity:label attribute in the activity page I've also checked the manifest file and it has the same value for the application:label The LicenseKey is being set after the Xamarin.forms Init call?

    thanks for your help.

    Wednesday, October 28, 2015 8:37 PM
  • User57869 posted

    I'm back from vacation again. There was not much time for support due to our full schedule on our tour through Laos (I'm not the kind of person who uses a vacation to do nothing). So I just answered some emails, but let the forum rest completely.

    My Mac missed me so much that it decided to go on strike and does not boot anymore. Until I sorted that out, I cannot debug anything. I'll be coming to speed slowly.

    @KrisAdams MR.Gestures is a plugin for Xamarin.Forms. You can use it in your iOS app which is written with XF. If your app uses only Xamarin.iOS, then you can't use it.

    @KeithRowe I heard from clients that they have problems on Win10. My dev machine is still Win8, so I couldn't try it myself yet. Just send me an email with your old and new app name and I'll issue a new license. I might cease to offer that in the future cause so many people do that and my effort already gets too high.

    @NielsCup I use MR.Gestures and XLabs with TinyIoC in my own app without any problems. Please make a sample project and end it to me via email.

    @BuildCalc I have to look at this in detail when my PC is up.

    @LyndonHughey How to configure your app name is described in http://www.mrgestures.com/#HowToConfigureAppName. If it still does not work, then please make a sample project and send it to me.

    Tuesday, November 10, 2015 8:42 AM
  • User40046 posted

    @MichaelRumpler
    Thanks for the reply, Michael. I resolved the problem, but I didn't update the thread.

    The project name wasn't being updated properly, even after the VS.net cleaning process. I manually cleaned my bin directory and things started working as expected.

    Wednesday, November 11, 2015 3:38 PM
  • User57869 posted

    @BuildCalc Yes, the Android.View.GestureDetector does not support panning after long press.

    I tried the workaround, but then the tap gestures did not work anymore. So I had to write my own detector for the Tapping, Tapped, DoubleTapped, LongPressing and LongPressed events. This has the advantage that these gestures now also work with multiple fingers.

    When you put a finger down and hold it there, you'll get a LongPressing event with NumberOfTouches=1. You can now move your finger and you'll get a LongPressed and some Panning events. If you don't move the finger, but put down another, you'll get another LongPressing event with the NumberOfTouches set accordingly. As soon as one finger moves or lifts, you'll get a LongPressed. There will be no further LongPressed events for every finger lifted.

    Version 1.2.5 has been released with those changes.

    And No, it is no bug, when multi finger gestures don't work on the other platforms / with the other gestures. This has not been implemented yet. Unfortunately the standard platform gesture recognizers cannot handle it. So it is quite some effort. It is on my list, but with low priority.

    Tuesday, November 17, 2015 12:15 PM
  • User99005 posted

    I am using a MR:ListView and need to capture a swipe event while also getting the data from the item swiped. using the itemselected event is not acceptable as i don't want the event raised everytime someone touches an item.

    I need to know which direction was swiped so i can increment or decrease a quantity for the item that was swiped.

    Is there a solution for this situation?

    Sunday, November 22, 2015 12:01 AM
  • User57869 posted

    @RichardRooks Use the Swiped event on each individual Cell and not on the ListView.

    Monday, November 23, 2015 10:58 AM
  • User40173 posted

    Is "Tapping" in a ListView broken with the latest Xamarin.Forms 2.0 hotfix?

    I just updated to Xamarin.Forms 2.0.0.6484

    As soon as I start scrolling in my ListView a "Tapping" event is fired on my Labels/Images (whereever I added a TappingCommand). This was not the case on the initial Xamarin.Forms 2.0 release. I'm on MR.Gestures 1.2.5.

    Monday, November 23, 2015 3:38 PM
  • User99005 posted

    getting a null reference error as shown in image attached

    Tuesday, November 24, 2015 2:12 PM
  • User57869 posted

    @BastiBrauning Yes, seems like on Android the Tapping events are raised for a Cell and its contents when a ListView is scrolled.

    I guess that's due to the layout updates Xamarin made in that version. But as those updates are only "experimental" and it changed in a build version, I'll wait a bit. Maybe they change it again and fix the bug. If they don't, then I'll search for a workaround after the next release of XF.

    Tuesday, November 24, 2015 4:29 PM
  • User57869 posted

    @RichardRooks You have to give me more information than that.

    When does it occur? On which devices? What XF and MR.Gestures versions do you use? Do you get the same error in the GestureSample?

    Tuesday, November 24, 2015 4:31 PM
  • User57869 posted

    I just released MR.Gestures 1.3.0-pre1.

    This version adds support for the Universal Windows Platform introduced in Xamarin.Forms 2.0. Although Xamarin released XF 2.0 as stable, I won't go as far yet and push it as a prerelease version. I also have some open bug fixes in the queue which I want to include in the final release. But several people already asked for a package for XF 2.0, so I push this out already.

    It works quite good with UWP. There were not many code changes compared to Windows Runtime. So at least it was not a complete new platform as was the case when I upgraded from Silverlight to Runtime.

    I did find two bugs in the GestuerSample on UWP, but they are caused by XF.

    Thursday, November 26, 2015 8:37 AM
  • User40173 posted

    @MichaelRumpler The problem on Android where tapping is fired on scroll isn't fixed in 1.3.0-pre1 yet?

    We need the Xamarin.Forms 2.0 hotfix published recently in combination with MR.Gestures. Is there a way to workaround this issue?

    Friday, November 27, 2015 2:25 PM
  • User57869 posted

    @BastiBrauning It's not fixed yet. That's what I meant when I wrote:

    I also have some open bug fixes in the queue which I want to include in the final release.

    Monday, November 30, 2015 11:36 AM
  • User73426 posted

    @MichaelRumpler when do you think we will be getting your final release? I have the same bug @BastiBrauning described and its really annoying :tongue:

    Thursday, December 3, 2015 6:46 PM
  • User40173 posted

    @MichaelRumpler any chance for an update? Still seems to be broken on Android with Xamarin 2.0 -pre1. We are unable to publish an Android app update with that bug.

    Wednesday, December 9, 2015 12:26 PM
  • User57869 posted

    @BastiBrauning Yeah, sorry, I had no time to work on MR.Gestures in the last couple of days. But I'm on it now.

    Wednesday, December 9, 2015 2:46 PM
  • User104835 posted

    Just bought a licence but the key doesn't seem to be correct, unless I'm doing something wrong.

    For testing I set the AppName to "GestureSample" and used the same key from the demo project, this worked fine. Since I bought the licence though, I changed the app name and set the licence corresponding to that app name - I'm now getting a null reference on the following line in iOS.

    MR.Gestures.iOS.Settings.LicenseKey = "56CP-.....-XTPS";

    I guess this is saying that the app name and the key don't match? There is a "." in my app name, I'm not sure if this would screw up the licence key?

    Mark

    Thursday, December 10, 2015 4:05 PM
  • User40173 posted

    Also we try to get UWP support, but currently using MR.Gestures 1.3.0 -pre1 in a ListView (no recycling) seems not to work:

       at MR.Gestures.UWP.UWPGestureHandler..ctor(IGestureAwareControl element, FrameworkElement view, IGestureListener listener)
       at MR.Gestures.UWP.UWPGestureHandler.AddGestureRecognizers(IGestureAwareControl element, FrameworkElement view)
       at MR.Gestures.UWP.UWPGestureHandler.OnElementPropertyChanged(Object sender, PropertyChangedEventArgs e, FrameworkElement view)
       at MR.Gestures.UWP.Renderers.AbsoluteLayoutRenderer.OnElementPropertyChanged(Object sender, PropertyChangedEventArgs e)
       at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
       at Xamarin.Forms.BindableObject.OnPropertyChanged(String propertyName)
       at Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
       at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
       at Xamarin.Forms.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget)
       at Xamarin.Forms.BindingExpression.Apply(Object sourceObject, BindableObject target, BindableProperty property)
       at Xamarin.Forms.Binding.Apply(Object newContext, BindableObject bindObj, BindableProperty targetProperty)
       at Xamarin.Forms.BindableObject.ApplyBindings(Object oldContext, Boolean skipBindingContext)
       at Xamarin.Forms.BindableObject.SetInheritedBindingContext(BindableObject bindable, Object value)
       at Xamarin.Forms.Element.OnBindingContextChanged()
       at Xamarin.Forms.View.OnBindingContextChanged()
       at Xamarin.Forms.BindableObject.SetInheritedBindingContext(BindableObject bindable, Object value)
       at Xamarin.Forms.Element.OnBindingContextChanged()
       at Xamarin.Forms.Cell.OnBindingContextChanged()
       at Xamarin.Forms.BindableObject.BindingContextPropertyBindingPropertyChanged(BindableObject bindable, Object oldvalue, Object newvalue)
       at Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
       at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
       at Xamarin.Forms.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess)
       at Xamarin.Forms.TemplatedItemsList`2.<UnhookItem>d__119.MoveNext()
    
    Thursday, December 10, 2015 5:13 PM
  • User57869 posted

    MR.Gestures 1.3.0 has been released.

    It fixes the bug @BastiBrauning and @LuisAplito had with the Tapping/Tapped event on Android.

    @BastiBrauning A ListView works fine in the GestureSample on UWP. Please send a repro project.

    Thursday, December 10, 2015 6:09 PM
  • User73426 posted

    Great news @MichaelRumpler , I just tested and its working great. However, it seems thats also happening with the "Up" Gesture, because I change a label's background color when "Down" gesture happens, and change it back again when "Up" gesture happens. However, when I click on the label and scroll (its inside a scrollview) up or down, and then release, the background color doesn't changes back.

    It used to work well on Android and still works great on iOS, maybe is the same bug on "Up" gesture?

    Thursday, December 10, 2015 7:19 PM
  • User57869 posted

    The problem with Tapping was in my TapGestureRecognizer which I introduced in 1.2.5. But Down/Up did not change at all. I'll have a look at it.

    Friday, December 11, 2015 8:24 AM
  • User40173 posted

    Sorry the UWP exception was a fault on my end (hidden well in the stacktrace...)

    The android stuff works great on my end, many thanks for the update!

    Another UWP thing: Are the tapping/tapped events not cosumed by MR.Gestures? When I have a MR.Gesture.Label on a ViewCell the Tapping command is executed and additionally the "ItemSelected" of the ListView.

    Friday, December 11, 2015 4:03 PM
  • User57869 posted

    I try not to consume anything at all so that the native functionality keeps working. So if Tapping and ItemSelected work at the same time, this is actually good.

    Unfortunately on Android ItemSelected does not work on MR.Gestures cells. I filed bug #36832 because of that. It is enough to add an empty event handler to the Touch event and the native touch handling like animation, ItemTapped and ItemSelected don't work anymore. But just handling an event should not change anything.

    Friday, December 11, 2015 10:07 PM
  • User40173 posted

    Okay I see.

    Basically I want the whole Cell to be selectable by a user to navigate to a Detail view. But also some parts of the cell should navigate the user to a different page.

    So the behaviour I try to achieve does work fine on Android/iOS currently because ItemSelected is not fired when clicking on an Image in the cell. But on UWP I'm struggeling because ItemSelected for the cell and Tapping for the Image in the Cell are both fired.

    I slightly modified your sample code http://pastebin.com/2mGQTjkp to demonstrate my UWP problem

    So how should I know that the user clicked on the label and not on any other part of the cell, because both events are fired? So currently my UWP app pushes two new pages on the stack.

    Saturday, December 12, 2015 10:20 AM
  • User57869 posted

    The only thing which comes to my mind is, that you wait a few milliseconds in ItemSelected and only do your stuff when no Tapping comes from the other elements.

    Saturday, December 12, 2015 12:40 PM
  • User57869 posted

    @LuisAplito When you scroll, then Android only sends a Cancel when your finger moves out of the original position of the element you're watching. Unfortunately it does not send anything to that element when the finger is actually removed. I didn't use the Cancel for the Down/Up gestures because I thought, it won't be of any use. I changed that now. When you drag your finger out of the element you're watching, then you now get a Up event with Cancelled set to true. Furthermore you can handle Down/Up on the ScrollView. These events will be raised as long as your finger remains inside the ScrollView. I tested that with TextCells inside of a ListView, but it's the same principle.

    Some people also reported NullReferenceExceptions on initializing the iOS app. It turns out that Xamarin Studio now writes the app name to CFBundleName in the info.plist file instead of CFBundleDisplayName which they used before. I read both values now when I check the LicenseKey.

    The new version 1.3.1 has been released to NuGet.

    Monday, December 14, 2015 12:25 PM
  • User55052 posted

    @LuisAplito Try the new version that @MichaelRumpler recently released (1.3.1)

    It fixed the same issue I was having on Android with the "Up" Gesture being consumed by the listview when scrolling or swiping.

    Monday, December 21, 2015 4:32 PM
  • User73426 posted

    Yeah it does @Rody, thanks @MichaelRumpler for fixing this, works like a charm!

    Tuesday, December 22, 2015 6:08 PM
  • User180128 posted

    Panning event within ScrollView stops firing in Android, but works in iOS.

    <ScrollView Orientation="Horizontal"> <mr:BoxView WidthRequest="50" HeightRequest="50" Color="Red" Panning="OnPanning" Panned="OnPanned"> </mr:BoxView> <mr:BoxView WidthRequest="50" HeightRequest="50" Color="Red" Panning="OnPanning" Panned="OnPanned"> </mr:BoxView> <mr:BoxView WidthRequest="50" HeightRequest="50" Color="Red" Panning="OnPanning" Panned="OnPanned"> </mr:BoxView> <mr:BoxView WidthRequest="50" HeightRequest="50" Color="Red" Panning="OnPanning" Panned="OnPanned"> </mr:BoxView> <mr:BoxView WidthRequest="50" HeightRequest="50" Color="Red" Panning="OnPanning" Panned="OnPanned"> </mr:BoxView> <mr:BoxView WidthRequest="50" HeightRequest="50" Color="Red" Panning="OnPanning" Panned="OnPanned"> </mr:BoxView> <mr:BoxView WidthRequest="50" HeightRequest="50" Color="Red" Panning="OnPanning" Panned="OnPanned"> </mr:BoxView> <mr:BoxView WidthRequest="50" HeightRequest="50" Color="Red" Panning="OnPanning" Panned="OnPanned"> </mr:BoxView> <mr:BoxView WidthRequest="50" HeightRequest="50" Color="Red" Panning="OnPanning" Panned="OnPanned"> </mr:BoxView> </ScrollView>

    OnPanning will keep firing only if finger is moved up or down (not activating horizontal scroll). As soon as you try moving finger left or right OnPanning stops firing and the final OnPanned is called.

    This however works on iOS. ScrollView will keep scrolling and OnPanning will keep firing until finger is raised.

    So is this limitation of Android platform or there is workaround with MR Gestures to make it work like on iOS.

    Monday, January 4, 2016 11:30 AM
  • User57869 posted

    @DanielZolnjan This is how Android works. Also see my last comment a bit up on this page.

    Monday, January 4, 2016 1:26 PM
  • User64943 posted

    Hi, do you have an example of how to use this library for pitching and scrolling but using code and not xaml?

    Thursday, January 7, 2016 6:43 PM
  • User57869 posted

    @BrunoPasquini.7813 In the GestureSample the ContentPageXaml uses pinch to zoom and pan to drag the image. In BoxViewCode you can find code which uses the MR.Gestures elements. There are also samples on my web page. The rest is simple data binding.

    Friday, January 8, 2016 10:31 AM
  • User67129 posted

    Has anyone ever tried to implement a swipe on a view which starts off the screen using MR.Gestures?

    i.e. for a Navigation drawer?

    So touch down would not start on the view but you would be panning across the view and your starting X position would be equal to 0?

    Wednesday, January 13, 2016 4:14 PM
  • User3516 posted

    @MichaelRumpler I have a question regarding using your gestures within a MasterDetailPage.

    I have a detail page with a horizontal pan gestures. On Android i can open the master page with a swipe from the very left of the screen and i can also close the master page with a swipe from right to left. The panning gesture in the detail page also works fine and as expected.

    On iOS this does not work. The pan gesture in the detail page does not work, panning from left to right will always open the master page. To get the pan gesture in the detail page to work i have to disable the panning behavior of the MasterDetailPage with "IsGestureEnabledProperty = false".

    Is it possible to get it to work on iOS as it works on Android?

    Wednesday, January 13, 2016 6:50 PM
  • User57869 posted

    @JKay I didn't try it, but you should be able to listen to Panning on the page and then just let the drawer follow your horizontal finger position until Panned. After that you can animate it to the open or closed position.

    @DirkWilhelm My pan handlers are overridden by the iOS UISplitViewController. Unfortunately I don't know how I could override that (and still keep the MasterDetailPage working).

    Friday, January 15, 2016 9:22 AM
  • User67129 posted

    @MichaelRumpler Thanks. Just implemented it as you said and seems to work really well.

    It doesn't register 0 as start position of the pan but I think I may try have a threshold. i.e. X < 50 and the acceleration. I'll play around with it today

    Friday, January 15, 2016 10:23 AM
  • User38322 posted

    @MichaelRumpler just implemented this in a project and it was a real 'life saver' thank you. Is it possible to add the information about Android scrollviews to your documentation - I wasted a while on trying to debug that behaviour.

    Many thanks Garry

    Thursday, January 21, 2016 9:24 PM
  • User40173 posted

    With the latest Xamarin.Forms 2.1.0-pre2 I'm sometimes getting the following exception reported in Insights from users:

    System.ExceptionException from HRESULT: 0x88000FA8
    Raw
       at Windows.UI.Xaml.Media.VisualTreeHelper.FindElementsInHostCoordinates(Point intersectingPoint, UIElement subtree, Boolean includeAllElements)
       at MR.Gestures.UWP.UWPGestureHandler.OnPointerPressed(CoreWindow sender, PointerEventArgs ev)
    
    Saturday, January 23, 2016 2:21 PM
  • User57869 posted

    @GarryWhittaker.7482 What exactly do you mean?

    @BastiBrauning With older versions FindElementsInHostCoordinates sometimes returned no elements when the gesture started shortly after the view has been initialized, but I didn't get any exceptions. I'll test more with XF 2.1.0-pre2 and maybe surround it with a try/catch.

    Wednesday, January 27, 2016 1:21 PM
  • User170242 posted

    Hi, I'm just trying out your library. I use a ListView within a shared project. Its working great since I start to implement a custom view cell which is inherited from your MR.Gestures.ViewCell. In my custom view cell is only one label. If I run my app the down event for the view cell is never fired but for the label i can catch the event. Maybe I do sth wrong?

    Any help appreciated.

    Thx in advance

    Tuesday, February 2, 2016 10:26 AM
  • User57869 posted

    @toSilence Does the Down event work on a ViewCell in the GestureSample for you? If your custom ViewCell also uses its custom renderer, then that renderer needs to inherit from MR.Gestures.platform.Renderers.ViewCellRenderer. If you do this on Windows, then the ListView must also be an MR.Gestures.ListView as there are no cell renderers on that platform. The functionality is built into the ListViewRenderer/TableViewRenderer.

    Tuesday, February 2, 2016 11:50 AM
  • User170242 posted

    @MichaelRumpler
    Yes the Down event is working. No I'm not using a custom renderer. I'm using it on Android. I will attach a file. Thx in advance

    Tuesday, February 2, 2016 12:13 PM
  • User57869 posted

    @toSilence I debugged that. It seems like if the Label handles the gesture, then the ViewCell doesn't get it anymore. The native Touch handler for the cell is never called, so I also cannot raise the event.

    The strange thing is, that the Touch handlers of the surrounding ListView and ContentPage are called, but not that of the ViewCell. I have no idea why. It may be related to bug#36832. The repro project attached to that bug shows that simply adding a Touch handler to a ViewCell (or a Label inside) prevents the default handling of that tap.

    On iOS and Windows (tested in UWP) the Down handlers of all Label, ViewCell, ListView and ContentPage are called.

    But it's a tough call anyway. @DominikWeber recently complained about a bug because the Down handler of a Grid is called although the touch was actually on a BoxView within the Grid which also handles the event. That raises the question: when should an event be raised for overlapping elements?

    Tuesday, February 2, 2016 7:35 PM
  • User170242 posted

    @MichaelRumpler
    Sorry I was busy with another project. Ok I checked the bug report it seems to be related with my problem.

    Maybe this is not working for any case but: I personally think an event should be raised anytime and if someone want to stop the event from bubbling up could set a handled property to true. I don't know if this implementation is possible for your library.

    Nevertheless I have to solve this problem.

    Can you imagine another solution with your library? Maybe I can overwrite some behaviour to solve just my case?

    Thank you advance

    Monday, February 8, 2016 7:30 AM
  • User57869 posted

    @toSilence The Handled property is there since the beginning and it was planned to do exactly that. But unfortunately Android has a very different notion of what handled means and so I could never implement it so that it works cross platform. I'd have to put much more effort in it which would also raise the price of MR.Gestures.

    You could just put a ContentView as main element of your ViewCell and handle the gestures on that. This shouldn't be any different from handling them on the ViewCell itself.

    Monday, February 8, 2016 8:15 AM
  • User167602 posted

    @MichaelRumpler Hi I really need som drag and drop functionality in a forms app and maybe this is the easiest way to get that. Will it be possible to have a few buttons to be dragged and dropped into some pre-defined targets, i.e. letter tiles into a game grid? After one tile is dropped that area should no longer be valid drop target. Thanks, H

    Wednesday, February 10, 2016 9:29 PM
  • User57869 posted

    @HenricBerglf Sure. Check out the GestureSample. It lets you drag some elements around. You'll get all the Panning and Panned events. The business logic - which element can be dragged and dropped - has to come from you.

    Thursday, February 11, 2016 7:26 AM
  • User40173 posted

    I experience another UWP error when popping pages:

    An exception of type 'System.ArgumentNullException' occurred in mscorlib.ni.dll but was not handled in user code
    
    Additional information: Value cannot be null.
           at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
       at MR.Gestures.UWP.UWPGestureHandler.RemoveInstance(IGestureAwareControl element)
       at MR.Gestures.UWP.Renderers.ListViewRenderer.Dispose(Boolean disposing)
       at Xamarin.Forms.Platform.UWP.VisualElementRenderer`2.Dispose()
       at Xamarin.Forms.Platform.UWP.VisualElementExtensions.Cleanup(VisualElement self)
       at Xamarin.Forms.Platform.UWP.NavigationPageRenderer.SetPage(Page page, Boolean isAnimated, Boolean isPopping)
       at Xamarin.Forms.Platform.UWP.NavigationPageRenderer.OnPopRequested(Object sender, NavigationRequestedEventArgs e)
       at Xamarin.Forms.NavigationPage.<PopAsyncInner>d__69.MoveNext()
    
    Friday, February 12, 2016 2:05 PM
  • User57869 posted

    @BastiBrauning When does this happen? Can you send me a repro project please.

    Monday, February 15, 2016 9:25 AM
  • User40173 posted

    @MichaelRumpler I'm not sure how to pack it into a repro project, since I'm currently unable to find out what is causing this (sometimes occurring) error.

    But I have another question, is it possible to disable all these debug printlines in MR.Gestures? On my release build I noticed the device log on android to be full of MR.Gestures output:

    02-19 14:02:07.860 13720 13720 I mono-stdout: HandleMotionEvent: Action: Down on MyRenderer, Pointer 0: 586/1301
    02-19 14:02:07.863 13720 13720 I mono-stdout: HandleMotionEvent: Action: Down on MyRenderer, Pointer 0: 406/20
    02-19 14:02:07.866 13720 13720 I mono-stdout: HandleMotionEvent: Action: Down on MyRenderer, Pointer 0: 406/20
    02-19 14:02:07.873 13720 13720 I mono-stdout: HandleMotionEvent: Action: Move on MyRenderer, Pointer 0: 587/1291
    02-19 14:02:07.873 13720 13720 I mono-stdout: HandleMotionEvent: Action: Move on MyRenderer, Pointer 0: 407/10
    02-19 14:02:07.873 13720 13720 I mono-stdout: HandleMotionEvent: Action: Move on MyRenderer, Pointer 0: 407/10
    02-19 14:02:07.889 13720 13720 I mono-stdout: HandleMotionEvent: Action: Move on MyRenderer, Pointer 0: 601/1221
    02-19 14:02:07.890 13720 13720 I mono-stdout: HandleMotionEvent: Action: Cancel on MyRenderer, Pointer 0: 601/1221
    02-19 14:02:07.890 13720 13720 I mono-stdout: HandleMotionEvent: Action: Cancel on MyRenderer, Pointer 0: 601/1221
    02-19 14:02:07.906 13720 13720 I mono-stdout: HandleMotionEvent: Action: Move on MyRenderer, Pointer 0: 631/1061
    02-19 14:02:07.923 13720 13720 I mono-stdout: HandleMotionEvent: Action: Move on MyRenderer, Pointer 0: 668/820
    
    Friday, February 19, 2016 1:14 PM
  • User57869 posted

    Oops, those slipped through. They should not be included in the release version of course. I disabled the debug statements in the source. They will be gone in the next version.

    Saturday, February 20, 2016 9:21 AM
  • User170242 posted

    @MichaelRumpler

    We bought your library and implemented it in our project. It works fine. I have just a detail question. The swipe left and swipe right on a ListView in Android seems to trigger only if my gesture is horizontal straight.

    Is there a config or a setting which we can set to enable a not so 'correct' detection? It is all about some degrees.

    Thank you in advance.

    Best Regards

    Friday, February 26, 2016 12:36 PM
  • User57869 posted

    @toSilence When you handle Swiped on a ListView, then it also raises on swipe up/down. When you handle it on a cell however, then that cell will be scrolled out of the way and/or your finger will be moved off the cell where it started. You could handle Down on a cell and Swiped and Up on the ListView. Then you see which cell it is in Down and you can handle the Swiped and reset the gesture on Up.

    Friday, February 26, 2016 1:16 PM
  • User40173 posted

    @MichaelRumpler As I stated earlier I experience crashes on UWP when popping pages with listviews, this is also happening for WinRT.

       at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
       at MR.Gestures.WinRT.WinRTGestureHandler.RemoveInstance(IGestureAwareControl element)
       at MR.Gestures.WinRT.Renderers.ListViewRenderer.Dispose(Boolean disposing)
       at Xamarin.Forms.Platform.WinRT.VisualElementRenderer`2.Dispose()
       at Xamarin.Forms.Platform.WinRT.VisualElementExtensions.Cleanup(VisualElement self)
       at Xamarin.Forms.Platform.WinRT.NavigationPageRenderer.SetPage(Page page, Boolean isAnimated, Boolean isPopping)
       at Xamarin.Forms.Platform.WinRT.NavigationPageRenderer.OnPopRequested(Object sender, NavigationRequestedEventArgs e)
       at Xamarin.Forms.NavigationPage.<PopAsyncInner>d__69.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Xamarin.Forms.NavigationPage.<PopAsync>d__68.MoveNext()
    

    I don't know why but Dispose is sometimes called when "this.Element" is null.

    So when the MR.Gestures.ListViewRenderer tries to remove touch listeners it'll crash in WinRTGestureHandler.RemoveInstance(element):

    when checking "WinRTGestureHandler.allGestureHandlers.ContainsKey(element)" and "element" is null it will result in a exception 'System.ArgumentNullException' occurred Value cannot be null.Parameter name: key

    So a fix might be checking the element for null before calling ContainsKey, e.g.

        public static void RemoveInstance(IGestureAwareControl element)
        {
          if (element == null || !WinRTGestureHandler.allGestureHandlers.ContainsKey(element))
            return;
    
        ....
        }
    
    Sunday, February 28, 2016 5:54 PM
  • User57869 posted

    @BastiBrauning I only saw those calls to Dispose after this.Element was set to null on UWP and there I also already had the null check. However I added that null check on all platforms now.

    As I already stated earlier I also disabled the debug statements.

    The new version 1.3.2 was released some minutes ago.

    Monday, February 29, 2016 12:58 PM
  • User170242 posted

    @MichaelRumpler
    In the ListView is a collection: HashSet CellsToDispose { get; }

    I'm using it in my code because it contains the cells of the current ListView.

    I know its not correct and I want to improve my code: So are there any other items which contains all the cells of the ListView? How can I manage/delete the items of CellsToDispose? Where are the items added to CellsToDispose? (because maybe I can create and mange my own collection)

    Thank you in advance.

    Best Regards

    Tuesday, March 1, 2016 1:25 PM
  • User57869 posted

    @toSilence That property is not intended to be used by you. It just helps me to maintain a list of the visible cells. It does not hold all cells in the list, but only the visible ones.

    Tuesday, March 1, 2016 3:00 PM
  • User170242 posted

    @MichaelRumpler

    Yes, I know it's not intended, but until now my only solution to get cells out of a ListView. Which is very important for us. Maybe you can imagine an 'official' collection of cells for further releases?

    I need this implementation for further/improved swipe detections. It's very powerful.

    Thank you in advance.

    Best Regards.

    Tuesday, March 1, 2016 3:07 PM
  • User57869 posted

    Well, an official collection has to come from Xamarin. I'm glad I can do it like it is now with the existing events.

    Tuesday, March 1, 2016 3:17 PM
  • User40173 posted

    Thanks alot for 1.3.2. Fixed my issues!

    Tuesday, March 1, 2016 3:32 PM
  • User32853 posted

    Hi,

    for some reason, the gestures do not work on UWP, when you compile the app with the Native Tool Chain. On my Lumia 550 (or the Emulator), the gestures work in Debug mode, but not in Release mode. Is this a known problem?

    Tuesday, March 1, 2016 4:54 PM
  • User57869 posted

    @MarkoLudolph I didn't try myself, but it seems like these troubleshooting guidelines could help.

    Tuesday, March 1, 2016 5:36 PM
  • User32853 posted

    That didn't help. And I'm using the gestures in code-behind, so this shouldn't be an issue in this case.

    Tuesday, March 1, 2016 6:29 PM
  • User32853 posted

    @MichaelRumpler Will you look at the issue? Actually, it is possible to debug the code in the Emulator, even when the Native Tool Chain is activated.

    I had to rewrite some parts of my app too to make it work. There was problem, that some streams where already exposed, when I wanted to use them, which does not happen with iOS/Android. It seems that the memory managment is more agressive.

    Wednesday, March 2, 2016 3:03 PM
  • User57869 posted

    @MarkoLudolph Yes, I'm just fighting with something different currently.

    Wednesday, March 2, 2016 3:16 PM
  • User32853 posted

    @MichaelRumpler Great, thanks.

    Wednesday, March 2, 2016 3:22 PM
  • User6276 posted

    @CodyRousseau said: @MichaelRumpler Hello! I am using the siwpe feature of MR.Gestures, but it picks up every swipe Direction as "Not Clear". Is it just really sensitive? Do you think it is the phone's issue? Thanks!

    I am also seeing this issue on Android only. I have verified that the LicenseKey matches the app name (I am using the sample app credentials while I verify the functionality). I tried forcing the app name to be wrong and it threw an exception on launch so I know that's not the issue.

    The swipe gestures come through just fine on iOS, but Android is NotClear on everything. I tested on both an Emulator and physical device. Here is my MainActivity. Am I doing any of the setup wrong?

    ``` [Activity (Label = "GestureSample", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity { protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle);

            global::Xamarin.Forms.Forms.Init (this, bundle);
            MR.Gestures.Android.Settings.LicenseKey = "ALZ9-BPVU-XQ35-CEBG-5ZRR-URJQ-ED5U-TSY8-6THP-3GVU-JW8Z-RZGE-CQW6";
            MR.Gestures.Android.Settings.SwipeVelocityThreshold = (float) .01;
            LoadApplication (new App ());
        }
    }
    

    ```

    Saturday, March 12, 2016 2:53 AM
  • User57869 posted

    @AndrewDitmer If you set the SwipeVelocityThreshold to such a small value, then almost every pan is recognized as swipe. When the velocity in both X and Y is big enough to count as a swipe, then the Direction will be NotClear. Just leave that property at its default value of 0.1. That should work in most cases. I just made that public so that you can adjust it on any devices, which have a weird ScaledMaximumFlingVelocity.

    If you need to check the direction more detailed, then you can also handle Panning. In the PanEventArgs you have a DeltaDistance and Velocity which you can both use to check the detailed direction of the move.

    Monday, March 14, 2016 10:14 AM
  • User6276 posted

    @MichaelRumpler that was it! I had set the velocity lower because the swipe wasn't firing as often as I wanted. I set it to .07 now. I'm trying to auto hide the Navigation Bar when scrolling a ListView (in Xamarin.Forms, of course). Your Swiped event on the ListView works like a charm:

    lst.Swiped += (object sender, SwipeEventArgs e) => { //Scroll down if(e.Direction == MR.Gestures.Direction.Up) { NavigationPage.SetHasNavigationBar(this, false); } //Scroll up if(e.Direction == MR.Gestures.Direction.Down) { NavigationPage.SetHasNavigationBar(this, true); } };

    Monday, March 14, 2016 12:54 PM
  • User114973 posted

    Hello @MichaelRumpler Can you help me with this bug. This is my project repository https://github.com/Knight1988/Xamarin.Form.MultiLevelListView

    I was test it on genymotion, ASUS_Z008D. The bug: - Run project - tap Mr.Gestures.MultiLevelListView button - tap "Root 0" - tap "Child 0-0" - tap "Child 0-1" - tap "Child 0-2" - tap "Child 0-0" - tap "Child 0-1" -> Tapping event not fire anymore. - tap "Child 0-2" -> Tapping event not fire anymore. - tap "Child 0-0" -> Tapping event still working.

    Thursday, March 17, 2016 10:04 AM
  • User57869 posted

    @MarkoLudolph said: for some reason, the gestures do not work on UWP, when you compile the app with the Native Tool Chain. On my Lumia 550 (or the Emulator), the gestures work in Debug mode, but not in Release mode. Is this a known problem?

    Sorry, first I had to release a new version of my app and then I forgot.

    I tested it now with the GestureSample. It was really not working with a release build. But as I said earlier, Xamarins troubleshooting guidelines help. I added this code to App.xaml.cs:

    var otherAssemblies = new[] {
        typeof(MR.Gestures.ContentPage).GetTypeInfo().Assembly,
        typeof(MR.Gestures.UWP.Renderers.PageRenderer).GetTypeInfo().Assembly,
    };
    Xamarin.Forms.Forms.Init(e, otherAssemblies);
    

    Now the gestures also work in release builds.

    Thursday, March 17, 2016 1:16 PM
  • User32853 posted

    @MichaelRumpler Thanks for looking at it. I forgot to add the UWP Assembly too, stupid me :neutral:

    Thursday, March 17, 2016 3:03 PM
  • User3516 posted

    I think there is an error in your compatibility documentation. For ScrollView and TableView it says that all events are supported in UWP, but pan and swipe doesn't work, so i guess the same restrictions as with WinPhone 8.1 regarding Direct Manipulation still apply to UWP?

    Wednesday, March 30, 2016 7:46 AM
  • User57869 posted

    @DirkWilhelm Yes, I only tested UWP on my LocalMachine with the mouse. In the Simulator in touch mode it still has the same problems like WinRT. I updated the web documentation.

    @SquallLeonhart.1032 I downloaded and tested your app and can reproduce your problems. However, it is a bit too complicated to debug such a big app. I cannot debug all your apps. That simply never pays back. Sorry.

    Tuesday, April 5, 2016 9:31 AM
  • User204351 posted

    @MichaelRumpler if I used my custom control,how to use your MR.Gestures. for example,I design a contentview as a custom control:

    and I used in my contentpage:

    how to fire the tapped event?

    Thursday, April 7, 2016 3:46 PM
  • User57869 posted

    @rocky Just inherit from MR.Gestures.ContentView instead of Xamarin.Forms.ContentView.

    Thursday, April 7, 2016 3:53 PM
  • User204351 posted

    @MichaelRumpler Because my code doesn't show in correctly.I post again here: the contentview:

    the used page:

    ......

    My question is : where is the right place that the MR.Gestures.ContentView should be?

    Friday, April 8, 2016 10:15 AM
  • User204351 posted

    ``

    ...... ``

    Friday, April 8, 2016 10:16 AM
  • User204351 posted

    @MichaelRumpler why I can't post my code? I place it in my file ,please see the attachment.

    Friday, April 8, 2016 10:20 AM
  • User57869 posted

    @rocky

    This instantiates a Xamarin.Forms.ContentView:

    <ContentView xmlns="http://xamarin.com/schemas/2014/forms"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    

    and this a MR.Gestures.ContentView:

    <mr:ContentView xmlns="http://xamarin.com/schemas/2014/forms"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        xmlns:mr="clr-namespace:MR.Gestures;assembly=MR.Gestures"
    

    Download the GestureSample. This includes all the samples you'll ever need.

    If you want to paste multiple lines of code in this forum, then you need to put a blank line before and after it and indent each line with at least four spaces or a tab. If the code is shorter, then you can also select it and press ctrl-O (or click the C icon above).

    Friday, April 8, 2016 10:58 AM
  • User47684 posted

    Hi. I recently purchased a license for Mr.Gestures and find it great. Admittedly I am just starting implementing it but I have hit a difficulty. I am using the ListView and am binding a command to the SwipedCommand property of a ViewCell. This is great and works and I can capture the direction of the swipe in my ViewModel. However, I would like to pass a parameter to the SwipeCommand handler. When I set the SwipedCommandParameter I am getting an invalid cast exception (presumably because its trying to cast my command parameter value to a SwipeEventArgs which is a parameter I have on my handler to get the direction of the swipe??).

    So, my question - is it possible to pass a CommandParameter of my choosing and still get the Direction of the swipe?

    <mr:ListView Opacity="0.85" x:Name="myList" SeparatorColor="#999999" Grid.Row="1" RowHeight="70" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" ItemsSource="{Binding MyItems}" HasUnevenRows="true" IsPullToRefreshEnabled="True"
                    RefreshCommand="{Binding LoadCommand}" IsRefreshing="{Binding IsLoading, Mode=OneWay}">
    <ListView.ItemTemplate>
        <DataTemplate>
            <mr:ViewCell x:Name="viewCell" SwipedCommandParameter="{Binding }" SwipedCommand="{Binding Path=BindingContext.SwipedCommand, Source={mext:ElementSource myList}}">
                <Label Text="{Binding ItemName}" />
            </mr:ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
    </mr:ListView>
    

    The following is an extract from my ViewModel:

    public MyViewModel
    {
        SwipedCommand = new Command<SwipeEventArgs>(OnSwiped);
    }
    
    public ICommand SwipedCommand { get; set; }
    private void OnSwiped(SwipeEventArgs e)
    {
        if (e.Direction == MR.Gestures.Direction.Right)
        {
                //Do something with binding of swiped object
        }
        else if (e.Direction == MR.Gestures.Direction.Left)
        {
                //Do something with binding of swiped object
        }
    }
    
    Saturday, April 16, 2016 10:47 AM
  • User57869 posted

    @TomasWinston

    The SwipeEventArgs (and all the other gesture EventArgs) have a Sender property which is set to the control on which the event happened. The MR.Gestures.ViewCell in this case. In your case, if you need SwipedCommandParameter="{Binding }", then you can do this in your OnSwiped method:

    var data = ((ViewCell)e.Sender).BindingContext;
    

    If you need additional data, then you can use your own ViewCell which inherits from MR.Gestures.ViewCell and add any data you want to it.

    Monday, April 18, 2016 7:57 AM
  • User47684 posted

    Perfect. Thanks Michael!

    Tuesday, April 19, 2016 3:11 PM
  • User125713 posted

    Hi @MichaelRumpler

    I've been getting this on my app in production. It happens very few times (it happened around 8 times out of the last 20,000 sessions) but it crashes the app. Any ideas?

    System.NullReferenceExceptionObject reference not set to an instance of an object

    Xamarin.Forms.BindableObject.GetValue(BindableProperty property) MR.Gestures.AbsoluteLayout.getTappedCommandParameter() MR.Gestures.GestureHandler.OnTapped(TapEventArgs args) MR.Gestures.GestureThrottler.OnTapped(TapEventArgs args) at MR.Gestures.iOS.iOSGestureHandler+<>cDisplayClass240+<b0>d.MoveNext () <0x1011a754c + 0x001c3> in :0

    Sunday, April 24, 2016 2:13 AM
  • User57869 posted

    @AntoineElDaher said: System.NullReferenceExceptionObject reference not set to an instance of an object Xamarin.Forms.BindableObject.GetValue(BindableProperty property) MR.Gestures.AbsoluteLayout.get_TappedCommandParameter()

    I never saw this before. I'd need a repro to check this, but that will be difficult if it only happens every few thousand times. It may also be a XF issue. There should not be a problem when I read the TappedCommandParameter.

    Monday, April 25, 2016 5:53 AM
  • User125713 posted

    @MichaelRumpler Thanks - is there some wait I can try/catch it externally? I can send you the code section (it's pretty simple) but it's very hard to repro.

    Monday, April 25, 2016 6:36 AM
  • User57869 posted

    No. I only read the TappedCommandParameter when I try to execute the command and this happens somewhere in the native event handler. You cannot catch that.

    Monday, April 25, 2016 6:51 AM
  • User125713 posted

    @MichaelRumpler - OK, then maybe you can catch it (or check for NULL) ?

    Here is the code FYI:

    viewLayout.Tapped += (object sender, MR.Gestures.TapEventArgs e) => {
                        try {
                            viewLayout.Opacity = 0.6;
                            viewLayout.FadeTo (1);
                            if (OnClickProfile != null) {
                                OnClickProfile.Execute (m.UserName);
                            }
                        } catch (Exception ex) {
                            App.Report (ex);
                        }
                    };
    

    The app still crashes (.Tapped is not even invoked).

    Monday, April 25, 2016 7:50 PM
  • User211521 posted

    Hello, I'm new to Xamarin, C# and Mr.Gestures.. I'm trying to reproduce my iOS game using Forms. I'm trying a simple test with Mr.Gestures, drag a boxView around a screen. Works great on iOS but the panning gesture doesn't seem to work on Android. There's not much code to it, just playing around.

    In my Content:

                box1 =  new Tile();
                box1.TranslationX = 100;
                box1.TranslationY = 100;
    
                MR.Gestures.AbsoluteLayout ab = new MR.Gestures.AbsoluteLayout ();
                ab.Children.Add (box1);
    
                ab.Panning +=  (object sender, MR.Gestures.PanEventArgs e) => {
                    BackgroundColor = Color.Green;
                    box1.TranslationX += e.DeltaDistance.X;
                    box1.TranslationY += e.DeltaDistance.Y;
    
                    Console.WriteLine("delta: " +  e.DeltaDistance.X);
                };
    
                Content = ab;
    

    The background does turn green, so the panEvent is happening. In the console I only see one "delta" message of 0.. so thinking maybe it's only called once rather then continuously as I attempt to drag the box around? Thanks for any pointers

    Daniel

    Wednesday, April 27, 2016 5:38 AM
  • Wednesday, April 27, 2016 5:59 AM
  • User211521 posted

    Ah.. rookie move. Thanks Michael, it's working now.

    Wednesday, April 27, 2016 6:09 AM
  • User32853 posted

    @MichaelRumpler Could you please send me or provide on nuget a version that is compiled against 2.2-pre4 on Android? I want to release a new version of my app, but it's not possible due the Android Support Library mismatch.

    Wednesday, April 27, 2016 12:28 PM
  • User57869 posted

    @MarkoLudolph

    Are you sure that the problems are caused by MR.Gestures? I tested it with the GestureSample and that works without problems with XF 2.2.0.4. I don't use any Android resources, so it shouldn't be a problem. Usually you can see which component causes the errors in Resources.designer.cs. Just double click the error messages and see in which lines the errors are.

    Wednesday, April 27, 2016 1:15 PM
  • User32853 posted

    Well, it was a nuget error. When I updated to the latest XF, I removed all external packages. Now I wanted to add them back, but nuget complained about the version mismatch. I simply added both dlls manually from the packages folder to the project and it's compiling and working again. Sorry for the false alarm.

    Wednesday, April 27, 2016 1:47 PM
  • User110134 posted

    LongPressing event is not firing on Android when running in "Visual Studio Emulator for Android" emulator. It works fine in both Windows Phone and iPhone emulator and real Windows Phone and iPhone devices.

    Currently I do not have an Android device so I can not test on a real Android device.

    Is this a known problem when running in the "Visual Studio Emulator for Android" emulator?

    Thanks Jimmi

    Wednesday, April 27, 2016 6:15 PM
  • User57869 posted

    @JimmiBendtson I have some problems with Hyper-V on my dev VM. So unfortunately I never got the VS Android emulator running. I always test MR.Gestures on real devices. That's also easier for multi finger gestures. These cannot be tested easily with the mouse. I have to play more with the VS Android emulator and get it running, but right now I cannot tell you why it doesn't work there.

    Thursday, April 28, 2016 4:05 PM
  • User125713 posted

    Hi @MichaelRumpler

    Any thought on when you can get a fix in for this?

    System.NullReferenceExceptionObject reference not set to an instance of an object Xamarin.Forms.BindableObject.GetValue(BindableProperty property) MR.Gestures.AbsoluteLayout.get_TappedCommandParameter()

    Saturday, April 30, 2016 3:11 AM
  • User211521 posted

    So far Mr.Gestures is working great for me, thanks for this lib. I'm still wrapping my head around C#, gestures etc.. Right now I have a game board and can move tiles around with panning, that's working well. My game board is a MR.Gestures.AbsoluteLayout and that's where I capture the panning gesture. If I add that game board as a child to another MR.Gestures.AbsoluteLayout then it seems the gestures are blocked by the parent and it no longer works. Is there a way to pass gestures though to children or ignore gestures on a parent in some way?

    Saturday, April 30, 2016 7:20 PM
  • User211521 posted

    Let me give some more info cuz I'm stumped. Here's my tileBoard:

    namespace Upwords
    {
        public class TileBoard : MR.Gestures.AbsoluteLayout 
        {
    
            public Tile currentTile;
    
            public TileBoard ()
            {
    
                Panning +=  (object sender, MR.Gestures.PanEventArgs e) => {                
    
                    if(currentTile != null) {
                        currentTile.TranslationX = e.Touches[0].X - currentTile.Width/2;
                        currentTile.TranslationY = e.Touches[0].Y - currentTile.Height/2;
                    }
                };
    
            }
        }
    }
    

    Here's a tile that goes in it (a stripped down ver with relevant parts):

    namespace Upwords
    {
        public class Tile : MR.Gestures.Grid
        {
            private string letter = "Qu";
            public int size = 50;
    
            public Tile ()
            {
    
                VerticalOptions = LayoutOptions.CenterAndExpand;
                HorizontalOptions = LayoutOptions.CenterAndExpand;
                WidthRequest = size;
                HeightRequest = size;
    
                //Add Letter
                letterLabel = new Label {
                    TextColor = Color.Black,
                    FontFamily = "Helvetica",
                    FontAttributes = FontAttributes.Bold,
                    FontSize = Math.Round( WidthRequest * .5),
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment = TextAlignment.Center,
                };
    
                letterLabel.BindingContext = this;
                letterLabel.SetBinding (Label.TextProperty, "Letter");
                Children.Add (letterLabel);
    
                //Tile touched
                Down += (object sender, MR.Gestures.DownUpEventArgs e) => {
    
                    WidthRequest = size*1.2;
                    HeightRequest = size*1.2;                   
    
                    int offset = (int)Math.Round((size*1.2-size)/2);
    
                    TranslationX += e.Touches[0].X - Width/2 - offset;
                    TranslationY += e.Touches[0].Y - Height/2 - offset;
    
                    ((TileBoard)Parent).currentTile = this;
                    ((TileBoard)Parent).RaiseChild(this);
    
                };
    
                //Tile Released
                Up += (object sender, MR.Gestures.DownUpEventArgs e) => {
    
                    WidthRequest = size;
                    HeightRequest = size;
    
                    ((TileBoard)Parent).currentTile = null;
    
                };
    
    
            }
    
            //Bindable Properties
            public string Letter {
                get { return letter; }
                set {
                    if (value == letter) {
                        return;
                    }
                    letter = value;
                    OnPropertyChanged ("Letter");
                }
            }   
        }
    }
    

    Now I add these to my content page and I can touch a tile which scales it up and pan it around:

    namespace Upwords
    {
        public class GamePage : ContentPage
        {
    
            public MasterDetailPage master;
    
            public GamePage ()
            {
    
                NavigationPage.SetHasNavigationBar(this, false);    
                BackgroundColor = AppStyle.BoardColor;
    
                Tile tile1 =  new Tile();
                tile1.Letter = "R";
                tile1.TranslationX = 100;
                tile1.TranslationY = 100;
    
                TileBoard tileBoard = new TileBoard ();
                tileBoard.Children.Insert(0, tile1);
    
            //Setting Content directly to tileBoard works.. I can touch and move my tiles around
            Content = tileBoard;
    
    
            //If I nest my tileboard under a stacklayout I no longer receive gestures on my tiles or tileboard
                MR.Gestures.StackLayout topStack = new MR.Gestures.StackLayout () {
                    Children = { tileBoard },
                };
                Content = topStack;
    
            }
    
    
        }
    }
    

    If you look at the last class GamePage, you'll see at the bottom if I set my Content to tileboard I get gestures for my tiles and tilelboard.. if I nest that under a stack layout I no longer get gestures to those children. Any ideas?

    Tuesday, May 3, 2016 4:14 AM
  • User57869 posted

    @AntoineElDaher said: Hi @MichaelRumpler

    Any thought on when you can get a fix in for this?

    System.NullReferenceExceptionObject reference not set to an instance of an object Xamarin.Forms.BindableObject.GetValue(BindableProperty property) MR.Gestures.AbsoluteLayout.get_TappedCommandParameter()

    If there is a NullReferenceException in Xamarin.Forms.BindableObject.GetValue then I cannot fix this. Xamarin has to fix the bug. Did you already file it on bugzilla?

    I added some try/catch code around the calls to all the CommandParameters as a workaround. But I cannot do this for everything I call in XF. So there will come the time where I won't do this anymore.

    The workaround is in the next version. I'll try to release it as soon as I get the time.

    Wednesday, May 4, 2016 7:22 AM
  • User57869 posted

    @DanielKramer I always try not to consume any gestures so that other elements which also handle them can still work. So when you have two layouts within each other, both should receive the gestures. Unfortunately sometimes this does not work. This depends on the platform and also on the contained elements.

    If you don't need any gesture handling on your topStack, you can try using a Xamarin.Forms.StackLayout instead. Sometimes you have to handle the gestures on a parent container and check if the touch coordinates are on a child element.

    Wednesday, May 4, 2016 7:37 AM
  • User125713 posted

    OK thanks @MichaelRumpler - please let me know when you release the workaround. I will file a bug against Xamarin but it will probably take a long time for them to fix it since it's hard to repro.

    Wednesday, May 4, 2016 6:35 PM
  • User57869 posted

    @AntoineElDaher

    I released MR.Gestures 1.3.3.

    This version adds try/catch around every time I read the *Command and *CommandParameter properties. I cannot reproduce those problems. I hope it helps.

    Saturday, May 7, 2016 10:52 AM
  • User125713 posted

    Thanks @MichaelRumpler I will include this in next week's release and will see if the crash disappears as expected!

    Saturday, May 7, 2016 4:27 PM
  • User125713 posted

    @MichaelRumpler - no more crashes since I updated to MR.Gestures 1.3.3, thanks!

    Saturday, May 14, 2016 7:11 PM
  • User125713 posted

    Hi @MichaelRumpler

    I'm having some trouble getting panning to work smoothly.

    In particular, if you're changing the TranslationX variable in response to the panning event, there will be some jumpiness.

    e.g. BoxView.Panning += BoxView.TranslationX = e.TotalDistance.X;

    I've tried to offset e.TotalDistance by the current BoxView.TranslationX and it is better but it it still jumpy.

    Is there a way for e.TotalDistance to actually refer to the point at which the panning started (even if the view was translated in the process)? It gets even worse if rotations are involved.

    Thursday, May 19, 2016 9:29 PM
  • User57869 posted

    See http://www.mrgestures.com/#Container

    Friday, May 20, 2016 6:03 AM
  • User164339 posted

    Is there a way to prevent the events from firing on elements behind the element that you are pressing?

    When I use the built in TapGestureRecognizer on my controls it only fires on the top element (which is good). But when I replace it with TappedCommand it will also press the button behind my view.

    This is a problem for example with popups.

    Sunday, May 22, 2016 8:52 PM
  • User57869 posted

    @JohnEeckhout This has been asked several times in this thread. See comments 178475 and 195113 for example.

    Monday, May 23, 2016 12:13 PM
  • User164339 posted

    @MichaelRumpler
    Thanks & sorry!

    Monday, May 23, 2016 5:34 PM
  • User197827 posted

    @MichaelRumpler I'm using your lib and I have a lot of reports about crashes from Insights. It happens on Android (basically on 5.1). I'm using MR.Gesturest v1.2.4.

    System.NotSupportedExceptionUnable to activate instance of type MR.Gestures.Android.SimpleGestureListener from native handle 0xbe869e5c (key_handle 0x3ef88aef).
    
      at Java.Interop.TypeManager.CreateInstance (IntPtr handle, JniHandleOwnership transfer, System.Type targetType) [0x001a4] in <filename unknown>:0 
      at Java.Lang.Object.GetObject (IntPtr handle, JniHandleOwnership transfer, System.Type type) [0x000e5] in <filename unknown>:0 
      at Java.Lang.Object._GetObject[T] (IntPtr handle, JniHandleOwnership transfer) [0x0001a] in <filename unknown>:0 
      at Java.Lang.Object.GetObject[T] (IntPtr handle, JniHandleOwnership transfer) [0x00000] in <filename unknown>:0 
      at Java.Lang.Object.GetObject[T] (IntPtr jnienv, IntPtr handle, JniHandleOwnership transfer) [0x00006] in <filename unknown>:0 
      at Android.Views.GestureDetector+SimpleOnGestureListener.n_OnLongPress_Landroid_view_MotionEvent_ (IntPtr jnienv, IntPtr native__this, IntPtr native_e) [0x00000] in <filename unknown>:0 
      at (wrapper dynamic-method) System.Object:fbc721f1-fe58-46dc-9524-49f14c36235e (intptr,intptr,intptr)
    
    System.MissingMethodExceptionNo constructor found for MR.Gestures.Android.SimpleGestureListener::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership)
    
      at Java.Interop.TypeManager.CreateProxy (System.Type type, IntPtr handle, JniHandleOwnership transfer) [0x00058] in <filename unknown>:0 
      at Java.Interop.TypeManager.CreateInstance (IntPtr handle, JniHandleOwnership transfer, System.Type targetType) [0x0012c] in <filename unknown>:0 
    
    Java.Lang.ErrorException of type 'Java.Interop.JavaLocationException' was thrown.
    
    Java.Lang.Error: Exception of type 'Java.Lang.Error' was thrown.
    
      --- End of managed exception stack trace ---
    java.lang.Error: Java callstack:
        at md5cf4b09d0afe9b09f8458554395119d93.SimpleGestureListener.n_onLongPress(Native Method)
        at md5cf4b09d0afe9b09f8458554395119d93.SimpleGestureListener.onLongPress(SimpleGestureListener.java:57)
        at android.view.GestureDetector.dispatchLongPress(GestureDetector.java:700)
        at android.view.GestureDetector.access$200(GestureDetector.java:40)
        at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:273)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:145)
        at android.app.ActivityThread.main(ActivityThread.java:6872)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
    
    Wednesday, May 25, 2016 9:46 AM
  • User57869 posted

    @MaximTk A lot has been talked about this bug already in the bugs 27408 and 39189. According to Jason Smith in this comment on bug 39189 and Jonathan Pryor's comment on his own answer on SO we should not simply add that constructor cause it would hide the real bug and just cause others.

    However, I also found that Xamarin did add that constructor themselves to some classes in XF. I found this comment in the InnerGestureListener:

    // This is needed because GestureRecognizer callbacks can be delayed several hundred milliseconds
    // which can result in the need to resurect this object if it has already been disposed. We dispose
    // eagerly to allow easier garbage collection of the renderer
    internal InnerGestureListener(IntPtr handle, JniHandleOwnership ownership) : base(handle, ownership)
    

    So I added that constructor to all my gesture listeners as well.

    I released MR.Gestures 1.3.4 with this change. Please test that version as I cannot reproduce it.

    Friday, May 27, 2016 10:02 AM
  • User125713 posted

    Hi @MichaelRumpler

    We have an app with 1.3.3/1.3.4 live for the past few weeks and users are complaining that swipe doesn't work very well. I am able to reproduce it pretty easily by swiping quickly.

    I get Direction = NotClear even though it's clearly a left or right swipe. If I do a slow/normal swipe it works fine.

    I tried to check e.Center but it seems it is the place where the swipe started, not ended.

    Any ideas?

    Saturday, June 4, 2016 9:40 PM
  • User125713 posted

    I did some debugging and even if DeltaX = 200 DeltaY = ~40

    It shows up as UnClear. Is there a way to configure the ratio for "clearness"?

    Saturday, June 4, 2016 9:45 PM
  • User57869 posted

    @TonyD

    You can adjust the platform dependant Settings.SwipeVelocityThreshold.

    MR.Gestures.Android.Settings.SwipeVelocityThreshold

    The velocity of a lifted finger relative to the ScaledMaximumFlingVelocity must be at least this value to count as Swipe. The default value is 0.1. Set it to a higher value if you want the user to move faster.

    MR.Gestures.iOS.Settings.SwipeVelocityThreshold

    The velocity (UIPanGestureRecognizer.VelocityInView) of a lifted finger in X or Y direction must be at least this value to count as Swipe. The default value is 800/800. Set it to a higher value if you want the user to move faster.

    WinRT and UWP:

    The velocity of a lifted finger must be at least this value to count as Swipe. The velocity comes from ManipulationCompletedRoutedEventArgs.Velocities.Linear and is in device-independent pixel per millisecond. The default value is 1. Set it to a higher value if you want the user to move faster.

    But be careful there. A direction will only be set, if the horizontal OR vertical velocity are high enough. If both directions are too high, then NotClear will be set.

    Alternately you could handle Panning and Panned instead of Swiped. In the PanEventArgs you get the DeltaDistance and Velocity and can check the direction yourself.

    Wednesday, June 8, 2016 12:44 PM
  • User1884 posted

    When inheriting from MR.Gestures.ListView gestures no longer work.

    public class MyListView : MR.Gestures.ListView etc....

    Friday, June 10, 2016 2:27 PM
  • User225119 posted
          <mr:ListView Margin="0,10,0,0" ItemsSource="{Binding ProductList}" LongPressedCommand="{Binding GoProductLongCommand}" LongPressedCommand="{Bindnig }"  TappedCommand="{Binding GoProductCommand}"  TappedCommandParameter="{Binding }">
                      <mr:ListView.ItemTemplate>
                        <DataTemplate>
                          <ViewCell>
                            <Grid Padding="5, 10, 5, 10" HorizontalOptions="FillAndExpand">
                              <Label Text="{Binding ProductName}" HorizontalOptions="StartAndExpand" />
                            </Grid>
                          </ViewCell>
                        </DataTemplate>
                      </mr:ListView.ItemTemplate>
                    </mr:ListView>
    

    What I want is, when selected some item, fire it for short tapped or long tapped. But use this code it has only fired long pressed command, not tapped command. why?

    It also not get the current selected item model for the command parameter, How do I put the current selected item context for the parameter?

    My last question is, Looks like your library need to pay. If I don't sure my app name, could I change the app name and continue use your library in the future?(some are looks like even has multiple app name for different language, I also don't know how to do for this)

    Saturday, June 11, 2016 2:15 PM
  • User164339 posted

    Would it be possible to make the gestures not fire when inputtransparent is true? I have had quite few problems when using MR.gestures with any sort of popup so I have tried to set the inputtransparent to true for all the elements behind my popup. This works for WindowsRT but not for Android (don't know about iOS). It would be a shame if I had to drop MR.gestures because of this.

    Sunday, June 12, 2016 6:32 PM
  • User197827 posted

    MichaelRumpler said: I released MR.Gestures 1.3.4 with this change. Please test that version as I cannot reproduce it.

    @MichaelRumpler, after updating to ver 1.3.4 LongPressing event doesn't fire (on android). So I can't to test it.

    Monday, June 13, 2016 12:39 PM
  • User57869 posted

    I updated the GestureSample

    • MR.Gestures to 1.3.4
    • Xamarin.Forms to 2.3.0.49

    and added a CustomListView in GestureSample/Views/Tests.

    @AlanSpires See the CustomListView. This inherits from MR.Gestures.ListView and it works. @AhsanHayat The same sample shows you how you can use RecycleElement in a custom ListView. @MaximTk In that sample LongPressing still works in 1.3.4 on Android.

    @huangjinshe A long press is no tap. It raises either one or the other depending how long you leave your finger on the screen. You also have your binding to the TappedCommandParameter wrong. "{Binding }" binds to the ViewModel of the whole page. To get the currently selected item, just use the lists SelectedItem property. If you want to sell your app under multiple names, then you also need multiple licences for MR.Gestures.

    @JohnEeckhout Thats a good idea, but unfortunately now it would be a breaking change which I'd rather avoid. How about you check the InputTransparent property in your gesture handler?

    Monday, June 27, 2016 12:52 PM
  • User225119 posted

    @MichaelRumpler said: I updated the GestureSample

    • MR.Gestures to 1.3.4
    • Xamarin.Forms to 2.3.0.49

    and added a CustomListView in GestureSample/Views/Tests.

    @AlanSpires See the CustomListView. This inherits from MR.Gestures.ListView and it works. @AhsanHayat The same sample shows you how you can use RecycleElement in a custom ListView. @MaximTk In that sample LongPressing still works in 1.3.4 on Android.

    @huangjinshe A long press is no tap. It raises either one or the other depending how long you leave your finger on the screen. You also have your binding to the TappedCommandParameter wrong. "{Binding }" binds to the ViewModel of the whole page. To get the currently selected item, just use the lists SelectedItem property. If you want to sell your app under multiple names, then you also need multiple licences for MR.Gestures.

    @JohnEeckhout Thats a good idea, but unfortunately now it would be a breaking change which I'd rather avoid. How about you check the InputTransparent property in your gesture handler?

    Why don't you just detect it if bind short and long command both? and then if all bind, raise it when time short or long?

    Monday, June 27, 2016 1:29 PM
  • User57869 posted

    @huangjinshe said: Why don't you just detect it if bind short and long command both? and then if all bind, raise it when time short or long?

    I do that. Start at the beginning. Read the MR.Gestures website and look at the code from the GestureSample.

    Monday, June 27, 2016 1:37 PM
  • User197827 posted

    @MichaelRumpler, you didn't add CustomListView to repository

    Thursday, June 30, 2016 3:19 PM
  • User57869 posted

    @MaximTk Oops, sorry about that. It's up now.

    Thursday, June 30, 2016 3:24 PM
  • User197827 posted

    @MichaelRumpler, in your CustomListView example LongPressing and LongPressed events only fires if you drag your fingers a litle bit while pressing.

    Friday, July 1, 2016 10:30 AM
  • User197222 posted

    Hey @MichaelRumpler I have some problems using MR.Gestures with Xamarin.Forms 2.3.0.107, as the tapped events somehow is not called on Android. I need to use 2.3.0.107, as I am using UWP. Do you have a workaround for this?

    Saturday, July 2, 2016 6:39 PM
  • User57869 posted

    @LasseMadsen Did you buy a license?

    Sunday, July 3, 2016 11:29 AM
  • User197222 posted

    @MichaelRumpler Yes

    Tuesday, July 5, 2016 9:00 AM
  • User57869 posted

    @LasseMadsen

    I updated the GestureSample from 2.3.0.49 to 2.3.1.111. With both versions Tapped works as expected.

    Usually Tapped is only raised after Tapping if NumberOfTaps was 1. Therefore it is never raised without a LicenseKey, because then NumberOfTaps remains 0.

    Can you try if Tapping is raised? Can you show your code?

    Tuesday, July 5, 2016 11:01 AM
  • User57869 posted

    @MaximTk said: @MichaelRumpler, in your CustomListView example LongPressing and LongPressed events only fires if you drag your fingers a litle bit while pressing.

    I could not reproduce this on my usual test device - a Nexus 10. However, I could reproduce it on my Sony Xperia Z5 Compact. Give me some time to look into it.

    Tuesday, July 5, 2016 11:12 AM
  • User229467 posted

    Hey pals. I need some assistance here. :smile:

    What's the deal with ListView on Android? The SelectedItem is not firing!

    I've extended MR.Gesture.Android.Renderers.FrameRenderer and watched the return for DispatchTouchEvent method. It always returns true, even if Mr.Gesture.GesturesHandler are all false.

    Is this behavior expected? Where can I find the documentation?

    Thanks!

    Tuesday, July 5, 2016 11:06 PM
  • User57869 posted

    @RodrigoElias This is caused by this bug. When you handle touch events on a cell, then SelectedItem does not work. But give them some time. The bug is only 7 months old. They should look at it soon.

    Wednesday, July 6, 2016 8:11 AM
  • User240351 posted

    Hi @MichaelRumpler, I am having a problem where Panning (and possibly other) events are still triggering after a Page's OnDisappearing event has been triggered. Is it possible to stop this from happening?

    Thanks.

    Friday, July 8, 2016 9:17 AM
  • User57869 posted

    @NathanM When a new page is pushed into view, then the old remains. It's just overlapped by the new page. Unfortunately some native gesture handlers don't check whether the controls they are attached to are still visible. I already worked around this for TabbedPage and CarouselPage. I will check the CarouselView once it is merged to the main Xamarin.Forms.dll. Please send me your code so that I can check why this happens for you and if I can introduce a workaround there too.

    Tuesday, July 12, 2016 8:23 AM
  • User57869 posted

    I just released MR.Gestures 1.3.5.

    This should fix the bug @MaximTk reported that LongPressing and LongPressed are not always raised on Android.

    Tuesday, July 12, 2016 1:51 PM
  • User110134 posted

    For various reasons I need to change the name of my app slightly on iOS compared to the Windows and Android versions. How does the licensing system support this? Have you considered changing from name and instead base the license on application ID?

    Saturday, September 17, 2016 9:01 PM
  • User57869 posted

    @JimmiBendtson MR.Gestures is licensed per app name. Like I already wrote on http://www.mrgestures.com/#Buy

    I.e. if your app has the same name on all three platforms, you only need one license key. If you have different versions of your app (e.g. a free and a pro one) with different names, then you need a separate key for each version.

    If you want to use two different app names, then you need to buy two licenses.

    Monday, September 19, 2016 7:27 AM
  • User195692 posted

    Hi, i have buy the license of this beautiful control but i have a problem, i have two image one above the other with ontap event. I wanna receive the event only on the top image, how can i do that?

    Tuesday, September 20, 2016 8:45 AM
  • User258643 posted

    Hi, I would like to use in my application the basic functionalities of your library - those that do not require a valid license key. Have I to buy the license in any case, or can I use your library without license?

    Thank you! Mike

    Tuesday, September 20, 2016 9:43 AM
  • User57869 posted

    @AlessioIafrate I have not been able to do that in a extensible way cross platform so you have to check yourself which image is on top. If the two images overlap only partly, then you can check the exact position of the tap in the Touches property of the TapEventArgs.

    @mikewhite2731 Currently you can use it without license if you don't need the EventArgs. I may change that in the future.

    Tuesday, September 20, 2016 10:48 AM
  • User195692 posted

    Thanks for your response, but touches have relative position, how can i have absolute position?

    Tuesday, September 20, 2016 12:53 PM
  • User57869 posted

    @AlessioIafrate You can either handle Down and Panning on the Page too or you search in this forum how to get the coordinates of any element on the screen. This is no MR.Gestures specific problem.

    Friday, September 23, 2016 8:34 AM
  • User146025 posted

    Is there any way to combine ffimageloading with mr.Image?

    Wednesday, October 19, 2016 6:49 AM
  • User57869 posted

    @DarioOrgaz

    The easiest way would be to place the image in a container from MR.Gestures.

    If you really want to combine both in one control, you'd have to repeat the code from one in your custom control as you cannot inherit from two classes. But that would be quite some effort.

    Wednesday, October 19, 2016 7:00 AM
  • User146025 posted

    @MichaelRumpler said: @DarioOrgaz

    The easiest way would be to place the image in a container from MR.Gestures.

    If you really want to combine both in one control, you'd have to repeat the code from one in your custom control as you cannot inherit from two classes. But that would be quite some effort.

    Thank you!

    Wednesday, October 19, 2016 8:11 AM
  • User150629 posted

    I'm having some troubles on UWP. I'm using MR.StackLayout for handling tapping events, but when I place a picker inside a SL, selecting an item causes the StackLayout's tapping event to trigger as well (if the selected item was above the SL, but not directly above the picker itself, as it's a drop-down picker)

    Also, in a MasterDetailPage, my menu has MR.StackLayouts for menu items, but even when the menu is not visible (it slides back), the tapping events for the menu items trigger when I tap where they used to be (as if the menu were still here, but it isn't).

    Do you know what could be causing this? (the same menu problem doesn't come up when I use simple buttons in place of MR.StackLayouts, so I'm assuming the problem is SL related)

    Thursday, October 20, 2016 9:12 AM
  • User150629 posted

    I've tried this out in a test app with just a MasterDetail page, and it still happens on a StackLayout on UWP, so it's definitely not a problem specific to my app. The menu shows up, closes, and the SLs from the menu still trigger on tapping on where they used to be (even though they are hidden at the time).

    Friday, October 21, 2016 11:41 AM