How To,Tutorial,Wintellect Blogs

Xamarin Forms for Windows Developers: Tips, Tricks and Lessons Learned, Part 2

Scott Peterson

4 May , 2017  

xamarin forms best practices

The Recap

This series of posts is devoted to all the things I wish I knew, as a long-time Microsoft Enterprise developer, before I provisioned my first xPlatform solution: The 60+ tips, tricks, and lessons learned I’ve accumulated over the last couple of years using Xamarin Forms (in Visual Studio for Windows.)

Many of these things are things an Android or iOS developer (i.e.; college student) probably already knows, but not a Microsoft developer. Some of these things will seem ridiculous to even share, and some so obvious that perhaps some developers will pretend I am the only one who didn’t already know about it. Some of these things will be super-extra important, and some will be meaningless to almost everyone. If you “lean native” you might even argue with me about some of them. That being said, here is the second batch of TTLL:

The Bits

If you’re not using Visual Studio Mobile Center you are totally missing out.

If you haven’t heard of Visual Studio Mobile Center it’s understandable. Have you heard of HockeyApp? If you haven’t heard of HockeyApp, have you heard of a Sony Walkman? Visual Studio Mobile Center is one of the coolest (and most under-marketed) “almost” brand new offerings, from Microsoft for managing mobile app development and development lifecycles.… Read more

, ,

How To,Tutorial,Wintellect Blogs

Xamarin Forms for Windows Developers: Tips, Tricks and Lessons Learned, Part 1

Scott Peterson

3 May , 2017  

Xamarin Forms for Windows Developers

The Confession

Okay, right off the bat, I’m going to admit I’m a Microsoft “bigot” or in less unfriendly terms, a Microsoft “super-enthusiast” with severe “Microsoft is actually better at everything” leanings. I’ve spent most of the last 30 years writing Microsoft-based solutions with Microsoft tools and technologies for clients who are Microsoft “shops.” Still, to this day, I never install any non-Microsoft products on my workstations, except the (still phenomenal) Adobe Fireworks. Yes, Fireworks.

The Challenge

For the last four years, as a weird twist of fate, I have been creating real apps for real clients using the Xamarin platform, and more often than not, Xamarin Forms (or is it Xamarin.Forms? …I can never figure out why we need a dot although it does look cooler that way.) One thing I have noticed is that almost every blog, every post, every slice of documentation that exists for Xamarin Forms seems to be written by someone who “skews native” and not by someone in the actual Microsoft development world. I know why this is, of course, but am not going to write it out loud.

The Observation

Over the last couple of years I also started to notice (mostly) Microsoft developers struggling with the same issues, the same hiccups, and doing the same things that “seemed right at the time” based on documentation, but realized one compile too late, those examples were just “examples” and not to be taken on an empty stomach.… Read more

, ,

Wintellect Blogs

Using XAML in F# Xamarin Forms – A Screencast

Jonathan Wood

1 Jun , 2016   Video

Now that we’ve seen the awesome new stuff in Xamarin Studio for F# let’s go a bit further and actually use some of those improvements to our advantage. However, instead of just a regular blog post, I thought it’d be worthwhile to do a screencast for y’all.

You can view the demo code directly on GitHub. Enjoy everyone!

 … Read more

, , ,


Microsoft Open-Sources Xamarin SDK, Adds New Developer Tools

Paul Ballard

27 Apr , 2016  

Microsoft today announced that it has open-sourced the Xamarin SDK for iOS, Android and Mac, making good on a promise it made during Build 2016.

The source code released to the .NET Foundation under the MIT license includes native API bindings for all three platforms, command line tools and Xamarin.Forms, the company’s cross-platform UI framework.

Developers who want to contribute to these projects can get cracking right away by visiting Xamarin’s open source page.

Microsoft made the announcement at Xamarin’s Evolve 2016 developer conference, where it also revealed a number of improvements to Xamarin and Visual Studio that will support better cross-platform development.

Updates to Visual Studio will make it easier for C# developers to create native iOS apps. Developers running Visual Studio on Windows will be able to simulate and interact with their iOS apps without leaving Visual Studio, even deploying and debugging them on iOS devices plugged into their Windows machines.

Xamarin Studio 6 for Mac has a new dark theme and now uses Roslyn, Microsoft’s open source compiler, providing a more consistent environment for developers who switch back and forth between Windows and OS X. Xamarin.Forms also got a number of new features, including real-time previewing of Xamarin.Forms XAML source from within the IDE.… Read more

, , , , ,

How To,Wintellect Blogs

First Impressions of the Xamarin Inspector

Jonathan Wood

6 Nov , 2015  

One of the pain points of using Xamarin Forms is that, just to see updates of any UI updates via XAML, you still need to save your changes, recompile, and relaunch the application. What’s more, is that you’d have to do this on each platform you’re targeting to make sure the UI looks good on each of them.

Well, the awesome folks at Xamarin know this and they’ve just released a preview edition of their newest application – Xamarin Inspector. I’ve played around with it a bit and below are my first impressions of the new application.

Take note that, in the time of this writing, the Xamarin Inspector is currently in early preview. More up-to-date information can be found on Xamarin’s documentation page.

When playing with the Xamarin Inspector I decided to use the demo project that we used for our post a while ago on testing Xamarin applications with F# and FsUnit. I felt this application gave a minimal amount of UI just to see what the Inspector could show.

How to Launch the Inspector

Since the Inspector is currently in preview, you would need to update your Xamarin Studio, in the Xamarin Studio -> Check for Updates screen to access the Alpha channel of the updates, like below.… Read more

, ,

Wintellect Blogs

Automating Xamarin Builds with FAKE – Part 3: Building and Running Unit Tests

Jonathan Wood

4 Nov , 2015  

While this will be a short post it’s also one that may be one of the most important ones to go over – running unit tests. Most of you probably know that being able to run tests early and often can save a ton of time if issues are found later on. One way to do this is to be able to execute your tests as easy as possible and this is possible within your FAKE script. Once again, FAKE comes with functions to be able to execute our tests in any framework you may be using.

Building the Unit Test Project

Of course, before running our tests we need to build the project. As we’ve seen in the previous posts, we’ll build the project with the MsBuild function.

let testProj = !! "FakeDemo.UnitTests/FakeDemo.UnitTests.csproj"

Target "Build-UnitTests" (fun _ ->
        |> MSBuild "FakeDemo.UnitTests\bin\Debug" "Build" [ ("Configuration", "Debug"); ("Platform", "Any CPU") ]
        |> Log "---Unit Test build output----"

Executing Unit Tests

Now here is another cool thing I really like from FAKE – they include helper functions that execute the tests for us. All we need to do is to pass in some configuration and we’re good to go!… Read more

, , ,

Wintellect Blogs

Linking Property Change Notifications in Xamarin Forms (or WPF/Silverlight)

Keith Rome

17 Oct , 2015  

I’d like to share a really awesome bit of code that I’ve been using in my XAML applications for a while now… there are many frameworks and examples out there, but I’ve not yet seen anyone else using this exact technique before…

MVVM in XAML UI Applications

If you are building app UIs using XAML, then you are more likely than not also using the MVVM design pattern. The general idea is that your code which handles application logic, business rules, etc. gets placed into ViewModel classes, and all visual widgets/controls get placed into XAML views. Typically we would have one View per ViewModel, but that’s not a requirement at all (more like a generalized observation), and in fact there are some situations where we might want to have multiple Views for the same ViewModel (or break a complex ViewModel into multiple parts while still connecting to a single View). The ViewModels are supposed to capable of standing alone, and we use data bindings and command bindings to connect the two. This way, we can unit test our ViewModels thoroughly, and (sometimes) allow UX designers to dictate the XAML layout directly.

That’s all fairly normal and typical.

As we dig a little more deeply into the mechanisms of data binding, we learn that part of the “magic” is achieved by way of the INotifyPropertyChanged interface (which includes only one thing – an event named PropertyChanged).… Read more

, , , ,

Wintellect Blogs

Automating Xamarin Builds with FAKE – Part 2: Building PCL, iOS, and Android Projects

Jonathan Wood

13 Oct , 2015  

Continuing from part 1 of this series we now have FAKE setup and ready for us to use our automated building needs. Now let’s build our Xamarin Forms application. In here we’ll go through how much FAKE helps us out by including built-in APIs that allow us to easily create our build targets. If you’ve never seen a FAKE build script before, you may be surprised by how little we need to do, since FAKE has all sorts of APIs that can be leveraged.

Of course, before we can really do anything else with our application we need to make sure everything builds so that will be the focus of this post.

Updated Build Script

In here we’re going to utilize FAKE’s Xamarin Helper library to help us build our iOS application. For our PCL and Android applications, however, we will just use FAKE’s MSBuild helper method as it doesn’t need anything special to build like iOS applications do.

The full script is at the bottom of this post and can be also found on GitHub, but let’s first break it up and talk a bit about each build target.


In most Xamarin applications, your PCL will house all of your core logic.… Read more

, , , ,

Wintellect Blogs

Implementing Sharing in Xamarin Forms

Jonathan Wood

9 Sep , 2015  

One thing you may want to do within your Xamarin application is to allow users to share items that your application may capture, such as photos. While this isn’t quite trivial in Xamarin Forms as it’s different for both iOS and Android, this isn’t too hard to implement with the power of renderers.

We’re going to look at a small demo app that downloads the Wintellect logo and allows it to be shared. Let’s take a look at how this all works.

Xamarin Forms

This demo project is pretty small so all we will have is just one XAML page and within the page will just have an Image. Below is our XAML and our View Model that we’re using as our BindingContext.

<?xml version="1.0" encoding="UTF-8"?>

        <ToolbarItem Text="Share" Order="Secondary" Command="{Binding Share}" Name="Action" />

    <Image x:Name="LogoImage" Source="" Aspect="AspectFit" />
public class ShareImageViewModel
  public Command Share { get; set; }
  public ImageSource Source { get; set; }

  public ShareImageViewModel()
      Share = new Command(ShareCommand);

  void ShareCommand()
      MessagingCenter.Send<ImageSource>(this.Source, "Share");

Notice in our ToolbarItem we have a Command.… Read more


Wintellect Blogs

Creating a Secondary (bottom) iOS Toolbar in Xamarin Forms

Keith Rome

2 Sep , 2015  

Xamarin Forms is a really great platform for mobile app development – we have used it on several apps now and had much better results than when trying to use the native SDK’s directly. Every now and then though you run up against a roadblock with the default renderer implementations where some feature (perhaps a key feature of your app) simply does not work the way it should. Secondary toolbars on iOS are one of those. I recently spent a couple of days trying to coax this feature into working properly before finally finding a solution (many other folks seemed to have simply given up on it).

What is a secondary toolbar?

Xamarin Forms supports the notion of Page-level toolbars. These are represented by the Page.ToolbarItems collection, and each ToolbarItem represents a clickable button that is hosted within the toolbar. In fact, there are two toolbars – the main “primary” toolbar that fills the right end of the navigation bar at the top of your screen, and also a “secondary” toolbar. You can only fit a few (two or three at most) toolbar items on the primary toolbar, and the rest are generally expected to go into the secondary toolbar. On Android this is done by adding an expansion button to the far right end of the primary toolbar which drops down a vertical menu containing the secondary toolbar items.… Read more

, ,