From UWP development to using Xamarin Forms for cross-platform development for a small audio application [Part 4]

Delaire Damien
3 min readDec 31, 2019
Xamarin Forms for Android

In this article I will go over my journey of building an application that runs on multiple platforms. My original application was a classic UWP application, in this part we will go over my attempt to try and use Xamarin Forms XAML in a 4 hours time box.

This article will be broken into 5 parts:

Building my Xamarin Forms app

After having build the demo app multiple times I was getting quite proficient at this.

The biggest hurtles that I got this time was getting the correct naming for my elements. The naming of some attributes also change however it is nothing that you shouldn’t be able to get over.

Here is what my final solution looked like:

Again, I used my shared library MyAudio.Common to share as much code as possible and in my Xamarin Forms project added the necessary code to get the demo app working.

In the Xamarin Forms project I copied and reworked the following code:

  • My HomeViewModel and ItemsViewModel
  • My app Helpers and my Services folder
  • My Styles, but this quickly became a problem as Xamarin Forms XAML != Microsoft XAML
Xamarin Forms XAML != Microsoft XAML

Home view development

On my home view I used a ListView that had for ItemTemplate a CollectionView. You can find more information about the collection view here.

My collection view was set with ItemsLayout=”HorizontalList” which then allowed me to have my items set Horizontally.

Next, I needed to rewrite the XAML for the Horizontal Items because the naming from Microsoft XAML is not the same as Xamarin Forms XAML.

Here is a very quick overview of what I had to change:

  • Border became BoxView
  • TextBlock became Label
  • StackPanel became StackLayout
  • Rounded Images needs to be encapsulated in a Frame to keep the rounded effect
  • FYI in Xamarin Forms there are no SolidColorBrush only Color

Finally, this is what I was able to get to in under 4 hours :

The application was running and I could navigate. To be honest I did not think that I could get the application running this fast.

The overall experience of using Xamarin Forms for Android was pretty good (apart from the fake XAML naming) however the only issue that I have with Xamarin Forms and my radio app is that it is very sluggish.

This did make me want to create 2 more articles on the side:

  • One where I will only create a Xamarin Android application to test and see if the application is sluggish, compared to a Xamarin Forms.
  • One where I will release the Xamarin Forms Android application to the store, and see how to use the Android Audio player.

Lastly we will see:

Happy coding

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Delaire Damien
Delaire Damien

Written by Delaire Damien

Technical Lead on (Windows & Smart TV apps) @Dailymotion, Windows Mobile/ Xbox/ Desktop Lover. Entrepreneur in spirit, I love working on side projects

No responses yet

Write a response