Sunday, April 24, 2016

Resolving common issues loading Xamarin Forms 2.0+ examples

After downloading and trying to run through a few Xamarin Forms demos, I've found that upgrading them to Forms 2.x seems to create errors.  Also you can encounter these errors even if you don't upgrade to the latest version of Forms. These issues will tend to focus on Android.

Issue 1: System.IO.FileNotFoundException: 

Could not load assembly 'Microsoft.Windows.Design.Extensibility, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?

Just delete the references which ends with *.Design. In my project it was: Xamarin.Forms.Core.Design,
Xamarin.Forms.Xaml.Design, 
Xamarin.Android.Support.Design.

See Also


Issue 2: Resources.String.ApplicationName and Resources.String.Hello are not defined

global::MYNAMESPACE.Resource.String.ApplicationName = global::MYNAMESPACE.Android.Resource.String.ApplicationName;

If you are getting an undefined error for either a resource string "Hello" or "ApplicationName" you have this issue.  These strings do not appear to be defined anywhere in the application code. Deleting it from the Resources.cs doesn't resolve the issue as it will just come back next time you build.
Fix it by running a clean and rebuild.

See also

Issue 3: Unsupported Android Target version.

If either the targeted version, or compile using version are set to a version of Android that your locally installed Android SDK doesn't support.  This is fixed either by installing that version using the Android SDK Manager or setting the Target and Compile versions in the Android project properties to something you do have locally installed.

 This App has an unsupported compile target.

Start the Android SDK Manager from Visual Studio

Or from Windows Start.

You can see here my current setup doesn't support Jelly Bean.  

In this case I chose to compile using Marshmallow, which is supported by my current setup.

Issue 4: Not configured to Deploy on Run (F5).

If you expect the App to compile, deploy and run when you press F5 or "Run" on the toolbar and it doesn't, then you'll need to adjust the build options.

You can see in this screen shot the Android project is not configured to deploy automatically when it is "Run".  Tick the box highlighted above, and you're set.



Wednesday, April 20, 2016

Auckland Xamarin Meet-Up Talk links

Steve Chadbourne – @stevechadbourne
Ben Rees @benrnz

Here some links to the tools Steve and I talked about tonight.  

Simple Xamarin Form Example: 
Learning Forms 
Gorilla Player
Open Source Xaml Viewer

Monday, April 18, 2016

Data Binding - The Awesome Sauce lavished onto Xamarin Forms

There are some great resources around introducing Data Binding for Xamarin Forms.  Here are some great posts I've come across that are worth reading and bookmarking.

For some background on getting started with Xamarin Forms. Check out the Xamarin guide here:
https://developer.xamarin.com/guides/xamarin-forms/

Xamarin have a solid section that gives a good start into learning XAML and Data Binding here:
https://developer.xamarin.com/guides/xamarin-forms/user-interface/xaml-basics/
Its definitely worth reading through all six sections.
Part 1. Getting Started with XAML
Part 2. Essential XAML Syntax
Part 3. XAML Markup Extensions
Part 4. Data Binding Basics
Part 5. From Data Binding to MVVM
Part 6. Compiling XAML

Data Binding Controls to each other to prevent/reduce writing code-behind.
https://blog.xamarin.com/advanced-data-binding-for-ios-android-and-windows/

Awesome Xamarin Forms How-To Commands

Recently read a great blog from David Britch giving a comprehensive guide to using commands with Xamarin Forms.

https://blog.xamarin.com/simplifying-events-with-commanding/