In a simple CollectionView example, SwipeView is throwing an exception with Android. Haven't tried iOS.
SwipeView works
Get an unhandled exception...
System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'
https://github.com/JohnLivermore/SampleXamarinApp/tree/swipeview
The SwipeView is in the Preview phase (we are working to improve it). To use it, you must opt-in by calling Forms.SetFlags ("SwipeView_Experimental")
before calling Forms.Init ()
.
The sample with the initialization change:
Issue9242.zip
thx for the answer @jsuarezruiz
Thanks for that. I was setting the experimental flag, but not with the exact code you have. I was using ...
global::Xamarin.Forms.Device.SetFlags(new[] { "SwipeView_Experimental" });
However, now when I run I am getting this...
Is this because my device is older? Here is what VS shows it to be...
This is working in iOS however. Just not Android (at least for my device).
Dear Xamarin Forms Team,
If I use these two sentences (in this order) inside MainActivity:
global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
global::Xamarin.Forms.Forms.SetFlags("SwipeView_Experimental");
I get an exception in Android with Xamarin Forms 4.5.0.495.
If I swap the order to this:
global::Xamarin.Forms.Forms.SetFlags("SwipeView_Experimental");
global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
it works OK in a page where I have a CollectionView and a SwipeView.
I don't think CollectionView needs the CollectionView_Experimental any longer?
@ignacioinnovo Please read https://docs.microsoft.com/en-us/xamarin/xamarin-forms/internals/experimental-flags for more about experimental flags. If you call SetFlags
more than once, you are actually overwriting the value you've previously set. Instead, you should call it once with all the flags you want enabled. And @JohnLivermore is correct. CollectionView is no longer experimental. Thanks!
My mistake. I didn麓t know that.
Thank you very much.
Most helpful comment
@ignacioinnovo Please read https://docs.microsoft.com/en-us/xamarin/xamarin-forms/internals/experimental-flags for more about experimental flags. If you call
SetFlags
more than once, you are actually overwriting the value you've previously set. Instead, you should call it once with all the flags you want enabled. And @JohnLivermore is correct. CollectionView is no longer experimental. Thanks!