What is the difference between Xamarin.Forms and Xamarin Native? [closed]

Xamarin.Forms Pros Create one UI for all platforms Use basic components that are available on all platforms (like Buttons, Textfields, Spinners etc.) No need to learn all the native UI frameworks Fast cross platform development process Custom native renderers give you the ability to adjust the appearance and feeling of controls Cons It’s still a … Read more

How to implement INotifyPropertyChanged in Xamarin.Forms

As a design methodology, its better to implement MVVM as a subclass and implement it to your ViewModel. Sample Implementation: public class ObservableProperty : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { var handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } } I also strongly suggest implementing ICommand as … Read more

Access the Android Special Folder Path by using Environment

You are looking for the root of GetExternalFilesDir, just pass a null: Example: var externalAppPathNoSec = GetExternalFilesDir(string.Empty).Path; Note: This is a Context-based instance method, you can access it via the Android application context, an Activity, etc… (see the link below to the Android Context docs) Shared storage may not always be available, since removable media … Read more

How can you restrict/control the navigation routes the user can visit based on login status/role?

Here is an example showing how you can control the visibility or navigation to your pages based on the login status of the user. By default Shell will always displays initially the first element defined in AppShell.xaml, in this case it will be Login.xaml page. In the below example “Page3” will be visible initially because … Read more

Visual studio (2015) emulator for android not working – XDE.exe – Exit Code 3

After hours and hours of research, and applying following steps I finally get it working: 1) Repair Android SDK – go to Programs and Features > Microsoft Visual Studio Emulator for Android > Change and hit “Repair” 2) Remove All Hyper-V virtual switches – go to Hyper-V > Virtual switch manager > Remove all virtual … Read more

How do I use SharedPreferences in Xamarin.Android?

The Xamarin.Android equivalent of SharedPreferences is an interface called ISharedPreferences. Use it in the same way, and you will be able to easily port Android code across. For example, to save a true/false bool using some Context you can do the following: ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences (mContext); ISharedPreferencesEditor editor = prefs.Edit (); editor.PutBoolean (“key_for_my_bool_value”, mBool); … Read more