Remove ios, windows8, and wp8 from Xamarin Forms PCL – nuget 3.0 opt-into error?

The solution that worked for me: Uninstall Xamarin.Forms: Right Click Solution -> Manage NuGet Packages -> Uninstall Xamarin.Forms -> Restart VS Then remove build platforms: Right Click Solution -> Properties -> Build -> under Targeting select Change -> Remove platform(s) -> Restart VS Reinstall Xamarin.Forms: Manage NuGet packages -> Search for Xamarin.Forms -> Install -> … Read more

Write device platform specific code in Xamarin.Forms

This is a scenario which is easily resolved with dependency injection. Have a interface with the desired methods on your shared or PCL code, like: public interface IUserPreferences { void SetString(string key, string value); string GetString(string key); } Have a property on your App class of that interface: public class App { public static IUserPreferences … Read more

Xamarin Forms Swipe Left/Swipe Right Gestures

No need third party libraries.. No need to pay.. Just add these two classes & Implement your swipe listeners Step 1: Copy paste these two classes SwipeListener.cs using System; using Xamarin.Forms; namespace SwipeLib { public class SwipeListener : PanGestureRecognizer { private ISwipeCallBack mISwipeCallback; private double translatedX = 0, translatedY = 0; public SwipeListener(View view, ISwipeCallBack … Read more

Horizontal ListView Xamarin.Forms

As of Xamarin Forms 2.3 CarouselView does just that, and more. Read more here. <ContentView HorizontalOptions=”FillAndExpand” VerticalOptions=”FillAndExpand”> <CarouselView ItemsSource=”{Binding MyDataSource}”> <CarouselView.ItemTemplate> <DataTemplate> <Label Text=”{Binding LabelText}” /> </DataTemplate> </CarouselView.ItemTemplate> </CarouselView> </ContentView>

How to resize images in xamarin.forms?

This can be used with a stream (if you’re using the Media Plugin https://github.com/jamesmontemagno/MediaPlugin) or standard byte arrays. // If you already have the byte[] byte[] resizedImage = await CrossImageResizer.Current.ResizeImageWithAspectRatioAsync(originalImageBytes, 500, 1000); // If you have a stream, such as: // var file = await CrossMedia.Current.PickPhotoAsync(options); // var originalImageStream = file.GetStream(); byte[] resizedImage = await … Read more