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?
@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.
@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?
@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.
@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:
@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);
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?
@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.
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).
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?
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.
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.get_TappedCommandParameter()
MR.Gestures.GestureHandler.OnTapped(TapEventArgs args)
MR.Gestures.GestureThrottler.OnTapped(TapEventArgs args)
at MR.Gestures.iOS.iOSGestureHandler+<>c__DisplayClass24_0+<b__0>d.MoveNext () <0x1011a754c + 0x001c3> in :0
@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.
@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.
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.
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.
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
@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.
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.
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.
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?
@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.
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()
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?
Posts
Well, an official collection has to come from Xamarin.
I'm glad I can do it like it is now with the existing events.
Thanks alot for 1.3.2. Fixed my issues!
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?
@MarkoLudolph I didn't try myself, but it seems like these troubleshooting guidelines could help.
That didn't help. And I'm using the gestures in code-behind, so this shouldn't be an issue in this case.
@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.
@MarkoLudolph Yes, I'm just fighting with something different currently.
@MichaelRumpler Great, 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?
@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.
@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); } };
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:
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:
Now the gestures also work in release builds.
@MichaelRumpler Thanks for looking at it. I forgot to add the UWP Assembly too, stupid me
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?
@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.
@MichaelRumpler if I used my custom control,how to use your MR.Gestures.
for example,I design a contentview as a custom control:
<Grid.RowDefinitions>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
and I used in my contentpage:
how to fire the tapped event?
@rocky Just inherit from MR.Gestures.ContentView instead of Xamarin.Forms.ContentView.
@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?
``
......
``
@MichaelRumpler
why I can't post my code?
I place it in my file ,please see the attachment.
@rocky
This instantiates a
Xamarin.Forms.ContentView
:and this a
MR.Gestures.ContentView
: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).
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?
The following is an extract from my ViewModel:
@TomasWinston
The
SwipeEventArgs
(and all the other gesture EventArgs) have aSender
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 yourOnSwiped
method: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.
Perfect. Thanks Michael!
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.get_TappedCommandParameter()
MR.Gestures.GestureHandler.OnTapped(TapEventArgs args)
MR.Gestures.GestureThrottler.OnTapped(TapEventArgs args)
at MR.Gestures.iOS.iOSGestureHandler+<>c__DisplayClass24_0+<b__0>d.MoveNext () <0x1011a754c + 0x001c3> in :0
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.
@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.
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.
@MichaelRumpler - OK, then maybe you can catch it (or check for NULL) ?
Here is the code FYI:
The app still crashes (.Tapped is not even invoked).
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:
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
@DanielKramer
See the FAQs: My event handler is called, but some event arg properties are not set.
Ah.. rookie move. Thanks Michael, it's working now.
@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.
@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.
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.
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
@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.
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()
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?