FlexButton: A super flexible button control for Xamarin.Forms

Although Xamarin.Forms includes a Button control with quite a few ways to customize its layout, I needed a more flexible button for a side project, that required two things the default implementation could not deliver: A round shape and a way to catch when a user presses and releases the button and for how long. So I ended up with creating a new control and contribute it to the community.

What does it do differently?

The FlexButton control I wrote, supports events for different states, color overlays and adjustable shapes and paddings. You can define if you want text, an icon or both in your button, which color they should have in normal- and pressed state, which size, padding or border-radius it should have and more.

For more details, bug reports and feature request, please check out the GitHub Repository. You will also find a sample project to play around with.

If you want to use it in your projects, simply add the NuGet package to your Xamarin.Forms project and add the control to your XAML layout.

Useful Developer Tools #9: Clean and Zip .NET projects from Finder

If you develop .NET projects, particularly in the Xamarin world, you might find yourself cleaning your projects (delete /bin and /obj folders) from time to time by hand. Especially, when you plan to send code to others as a compressed .zip file, you might want to remove those folders beforehand.


The amazing Colby L. Williams created a Finder extension for macOS, that does exactly that for you. Simply right-click a folder and select Services -> Clean to get rid of all /bin and /obj folders of its descendants or Services -> Clean & Compress to do the same and zip it afterwards.


Enable and control iOS 11 Large Titles in Xamarin.Forms

With iOS 11, Apple introduced a bunch of new design elements to its mobile platform. One of them are larger titles, that sit in the Navigation Bar and can be scrolled away when more space is needed. Large Titles can be enabled with a few lines of code in iOS. To use them with Xamarin.Forms, we need to extend the framework on our own, as the new titles are not officially supported yet.

iOS 11 Large Titles Screenshots

UPDATE: With Xamarin.Forms 2.5, a platform-specific for Large Titles has been added. Read this post for further details.

Enable Large Titles

To add support for Large Titles in Xamarin.Forms all we need to do is overriding the existing NavigationRenderer and enable Large Titles application-wide. Simply add this Renderer to your iOS project and they will be shown everywhere.


Control when to display Large Titles

Being in control of when to display the new titles or not is a nice feature as they totally do not make sense on every page and this gives us more flexibility on when and where to use them.

Unfortunately, Xamarin.Forms is struggling with the new Large Titles and bottom offsets sometimes, especially when combined with a TabbedPage. So we need a way to switch them off manually for each page.

Extend Content Page

For this, create a new type of ContentPage in your Xamarin.Forms project, that is aware of Large Titles and offers a property to switch them on and off manually.

Every page, that should be able to switch off large titles (we enable them by default in the Custom Renderer above), must now be type of our newly created page. This has to be declared in XAML…

… and the code-behind as well.

Add a Custom Renderer

All we need now is a Custom Renderer for the new page, that respects the HasLargeTitle property and sets the in iOS 11 introduced LargeTitleDisplayMode property accordingly. Create a new Custom Renderer in the iOS project and expose it.

Et voilà! With 12 lines of code, Xamarin.Forms becomes capable of using the new Large Titles and looks nice and modern for Apple’s new version of iOS.

Swipecards: A Tinder-like swipe control for Xamarin.Forms

For a side-project of mine, I created a Xamarin.Forms control, that lets the user wipe away cards in different directions, similar to the popular Tinder app.

The control is still work in progress and will be extended over time, but I decided to publish the current version as it was good enough to go into production for my project. Feel free to use it, contribute and provide feedback! It supports fully customizable ItemTemplates and Data Binding for most properties.

Take a look at the GitHub Repository for further details and a full API-reference. You will also find a sample project to play around with.

If you want to use it in your projects, simply add the NuGet package to your Xamarin.Forms project and add the control in your XAML layout.

Disable Visual Studio App Center when running on a Simulator, Emulator or Test Cloud device

When tracking usage statistics and crashes with Visual Studio App Center, you usually only want real-world data in there and filter out data that gets generated while developing or testing the app. To avoid sophisticated insights like those in the screenshot below, developers need to define, when Visual Studio App Center should track data and when it should not.

Analytics and crash data usually should not impact those statistics, when an app is

  • Running in Debug Mode
  • Running on a Simulator or Emulator
  • Running in the Xamarin Test Cloud

Before starting the client analytics using the AppCenter.Start() method, we should scan the current environment to decide whether to run this command or not. For this, we implement a method on each platform, that scans if the current app environment is a real-world scenario.

You might want to check if the app is running on a Test Cloud device to avoid messed up UI Test from the Distribution Dialog and Denmark (where the Test Cloud devices live) as you most popular country in the statistics!

The App Center Test Cloud (formerly known as Xamarin Test Cloud) sets specific environment variables on its devices, that we can examine and use to check if the app is running on a test device.


Creating an interface for the small Environment Service helps to unify its implementations and usage within Dependency Injection.

iOS implementation

Android implementation

Add the real-world check before starting to track analytics

Before starting the App Center service now, we can simply fire an EnvironmentService.IsRunningInRealWorld() check and only proceed if it is positive.


If you are using Xamarin.Forms, just register the platform implementations at the built-in Dependency Service.

Now you can call the environment service in the App.xaml.cs like below.

This should avoid having sophisticated Development and Testing data in you Visual Studio Mobile Center Analytics and Crashes section.

Enjoy the cleaned up dashboards!

Useful Developer Tools #8: Colormind

A while ago, I wrote about the Adobe Color Wheel here, which helps design noobies to create a color scheme for their product using colors that fit together. The challenge with Color Wheel is, that you still need a “feeling” for colors to create a good looking scheme.

Colormind goes one step further and literally generates you a complete color scheme without having the user know anything about colors. It also offers pre-defined schemes for Christmas, Spring and more. When you are struggling with color schemes, colormind.io might be something for you!


Replace your old cronjobs with free Azure Functions within 5 minutes

For some of my older projects, I had some repetitive tasks where a simple job triggers a script to run and load some data from the web. For this, I used good old cronjobs like the ones cronjob.de offers. As this was expensive und quite unsatisfying in terms of flexibility, I decided to move them over to Azure, which just took me five minutes and cost me nothing.

My old cronjobs just did a super simple thing: They called a PHP script every 15 minutes, which was hosted at a hosting provider and did some work for me. So the cronjobs were simple HTTP calls and I had no feedback about results, success or failure. So it was time to move the over to Azure Functions.

Create an Azure Function App

Azure Functions are the Serverless solution that Microsoft offer in their cloud. In a Serverless context, you even go one step further than PaaS does and only provide some code to the cloud that should run, when  you want it to. You don’t care about the architecture beneath it and just want your code to run. Perfect for recurring jobs.

To create a new Azure Function, log into the Azure Portal, select Add > Compute > Function App and follow the wizard to create a service for your functions.

Add your first function

Once Azure has finished creating your Function App, you can create your first function in it. The quickstart guides you through the creation of your first one. As we want to create a cronjob equivalent, the Timer scenario looks like the best one for us. As a .NET guy, I choose C# as my language, but you can also pick JavaScript is you like.

As soon as the function got created, we can start coding. To replace my existing cronjobs, I wrote the following lines.

Define the trigger

Now that the logic is created, we have to define a trigger for the function. At the side menu, we can find several settings. At the Integrate tab, we can define triggers. Because we chose the Timer template earlier, a timer trigger has already been created for us. In the Schedule box, we can define the trigger time formatted as a Cron expression. The predefined 0 */5 * * * * will trigger the function every 5 minutes, so let’s increase it to 15 minutes: 0 */15 * * * *.

Test your function

To test what we created, get back to the Develop tab and open the Logs by clicking at the according button at the top. Now we can Run the function and follow its process in the Logs window. For more details, you can visit the Monitor tab in the menu.

What does it cost?

Nothing. For the moment, at least. As we chose the Consumption Plan as the Hosting plan for our function when creating them, we will be billed on a pay-per-use mode.

The price for execution time is $0.000016/GB-s and $0.20 per Million executions. For us it is still free, as the first 400,000 GB-s or the first 1 Million executions come for free every month. If your function got 1 GB of RAM attached and runs for one second, Microsoft counts this as a GB-s.

Does it scale?

It does and this is one of the coolest things about Azure Functions. Up to a specific (very large) size, these functions scale automatically and provision the best possible compute base automatically to keep them performant. But please keep in mind that the programming model for Azure Functions is stateless and there are VMs running below, that are not visible for you. So state-inconsistency and VM startup time is something you might have to consider.

What’s next?

If you liked the concept of Azure Functions, why don’t you create more? There are many more triggers beside the timer like WebHooks, EventHubs, or Blob Storage changes. Of yourse, you can alos trigger a function manually, with the REST API. You can also define outputs for the results of your functions to use them for processing data.

So give it a try and fall in love with Serverless Computing!

Useful Developer Tools #7: Spotify playlist “Ambience While Coding”

The new year has just started and many of us still have some holiday to spend time on our beloved coding projects. I personally love listening to some music while coding but especially when it comes to concentration, I find songs with lyrics distracting.

Good thing, that Spotify user Emiliy Cheng created a beautiful playlist full of orchestral and movie songs, perfectly for coding: Ambience While Coding (Orchestral, Epic, Movie Scores). If you are in love with code and music, you should check it out!

Interested in more Useful Developer Tools? Take a look at the whole series.

Wallpaper of the month (December 2016): Blurry Corn

New month, new wallpaper. As it is getting really cold outside, I decided to use a summer wallpaper, that is also compatible with 21:9 ulta-wide screens!

You can find all wallpapers of this series inside this OneDrive folder.

Blurry Corn

Free self-guided Xamarin workshop

Two days ago, I gave a Xamarin workshop at the Microsoft Technical Summit 2016 conference in Darmstadt (Germany). This was a full-day workshop with a Xamarin introduction at the beginning and a guided workshop experience, where the participants learned how to

  • Setup a Xamarin development environment
  • Create native cross-platform apps with Xamarin
  • Share as much business logic as possible between iOS, Android and Windows
  • Share layouts with Xamarin.Forms
  • Create a clean architecture
  • Spin up an Azure Cloud backend and connect the app to it easily

I decided to make this workshop open and available for free, so that anyone can take it as a self-guided tour through the world of Xamarin development. So feel free to use it in whichever form you like. If you get stuck or have questions, don’t hesitate to ask them here in the comments.

Screen Shot 2016-12-10 at 22.30.58

Beside, as this is an open-source project, contributions are very welcome! If you know something better, have a good idea, want to correct something or know a better teaching style please feel free to create a pull request. This workshop is getting better with every single contribution!

Have fun with it. You can find the workshop on GitHub.