#Xamarin #SwipeView in a ListView

gestures-tap-swipe.pngOnce you’ve upgraded to at least Xamarin 4.4, you can use the new SwipeView to easily add Swiping. If you have an older app with ListViews that haven’t yet been upgraded to the CollectionView, you can still use SwipeViews. Here’s how to retrofit:

In your iOS project add this to the Finished Launching before the Forms Init()

public override bool FinishedLaunching(UIApplication appNSDictionary options)

In your Android MainActivity add:

protected override void OnCreate(Bundle bundle)

Now, open your Cell.xaml ContentView used by your ListView and wrap the full ContentView.Content in a SwipeView:

	<SwipeView android:SwipeView.SwipeTransitionMode="Drag"        
				<SwipeItem Text="Favorite"
				<SwipeItem Text="Delete"

Your content here then close it up:


Then you’ll be able to swipe!

2020-01-16 11_46_53-Window.png

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s