MVVMCross support for Xamarin.iOS Storyboards

There is at least one sample published showing the use of Storyboards – the rather oddly named eh – https://github.com/slodge/eh This sample worked by: letting the Storyboard control the navigation using MvxViewController as a VC base class (in place of UIViewController) manually setting the ViewModel in one case – by setting it directly before calling … Read more

How to terminate a Xamarin application?

If you are using Xamarin.Forms create a Dependency Service. Interface public interface ICloseApplication { void closeApplication(); } Android : Using FinishAffinity() won’t restart your activity. It will simply close the application. public class CloseApplication : ICloseApplication { public void closeApplication() { var activity = (Activity)Forms.Context; activity.FinishAffinity(); } } IOS : As already suggested above. public … Read more

Xamarin Studio – can not login – One of the identified items was in an invalid format

Guys from Xamarin Support already post an answer to this http://forums.xamarin.com/discussion/63675/activation-error/p1 In general you should Update to the “Cycle 6 – Service Release 3” versions or newer. The minimum version of Xamarin Studio that supports MSDN licenses is here: http://download.xamarin.com/studio/Mac/XamarinStudio-5.10.3.51-0.dmg Log out and log back into your Xamarin account following the “Quick manual refresh steps” … Read more

Xamarin Forms Android Error: Please install package ‘Android Support Library’

The error message tells you pretty explicitly what the error is C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\android_m2repository_r10.zip is not a valid zip file How to fix it Please download https://dl-ssl.google.com/android/repository/android_m2repository_r10.zip and extract it to the C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\content directory.

How to make long press gesture in Xamarin Forms?

You can do it cross platform way by attaching the below behavior, as long as it is Xamarin.Forms.Button or a sub-type of it. using System; using System.Threading; using System.Windows.Input; using Xamarin.Forms; namespace App.Controls.Behaviors { public class LongPressBehavior : Behavior<Button> { private readonly object _syncObject = new object(); private const int Duration = 1000; //timer to … Read more

How to view PDF file using Xamarin Forms

Android: public void OpenPdf(string filePath) { Android.Net.Uri uri = Android.Net.Uri.Parse(“file:///” + filePath); Intent intent = new Intent(Intent.ActionView); intent.SetDataAndType(uri, “application/pdf”); intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask); try { Xamarin.Forms.Forms.Context.StartActivity(intent); } catch (Exception) { Toast.MakeText(Xamarin.Forms.Forms.Context, “No Application Available to View PDF”, ToastLength.Short).Show(); } } iOS, a bit more complex and requiries some extra classes: public void OpenPDF(string filePath) { FileInfo … Read more

How to log in to Facebook in Xamarin.Forms

UPDATE (10/24/17): While this way of doing things was okay a few years ago, I now strongly advocate for using native UI for doing authentication, as opposed to the webview method shown here. Auth0 is a great way to accomplish native UI login for your apps, using a wide variety of identity providers: https://auth0.com/docs/quickstart/native/xamarin EDIT: … Read more