Xamarin.Forms Picker SelectedIndexChanged on Android vs iOS

Picker is a very common UI control. In order to capture user input we have to listen to ‘SelectedIndexChanged’ event, which unfortunately behaves differently on Android and iOS:


On iOS ‘SelectedIndexChanged’ is triggered every-time user moves / scrolls the list. ‘Done’ button is there only for hiding the list. However, on Android ‘SelectedIndexChanged’ event will be triggered only once, after user selects an item. This is because on Android the list is displayed as a popup which disappears right after user input.

That may sound as a minor problem, unless you have to do some heavy work on the UI on each ‘SelectedIndexChanged’. Luckily, since Xamarin.Forms 2.3.4 it is possible to set the expected behaviour on the Picker control:

var picker = new Picker();

Alternatively we can do the same thing in XAML.

We have to define a new namespace:


And consume it the next way:

<Picker ios:Picker.UpdateMode=”WhenFinished” .. />

Easy as it is! So there is no need to write workarounds anymore.

P.S.: Additional information can be found here.

Numeric keyboard with "Done" button on iOS Xamarin.Forms

‘Done’ button on Numeric keyboard on iOS is a very popular clients request, but it does not appear out of the box. Luckily the solution is very easy (as usual), all we have to do is to extend ‘Entry’ control and to add a custom renderer:
using Xamarin.Forms;
namespace YourNamespace.Controls
public class ExtendedEntry : Entry { }
Based on example from: https://forums.xamarin.com/discussion/18346/add-done-button-to-keyboard-on-ios
using System.Drawing;
using YourNamespace.Controls;
using YourNamespace.iOS.Renderers;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(ExtendedEntry), typeof(ExtendedEntryRenderer))]
namespace YourNamespace.iOS.Renderers
public class ExtendedEntryRenderer : EntryRenderer
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
if (Element == null)
// Check only for Numeric keyboard
if (this.Element.Keyboard == Keyboard.Numeric)
/// <summary>
/// <para>Add toolbar with Done button</para>
/// </summary>
protected void AddDoneButton()
var toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, 50.0f, 44.0f));
var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate
var baseEntry = this.Element.GetType();
toolbar.Items = new UIBarButtonItem[] {
new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
this.Control.InputAccessoryView = toolbar;
As you can see all the ‘magic’ is happing in AddDoneButton() method. We create a toolbar and add a ‘Done’ UIBarButtonItem which will hide the keyboard and send a ‘Completed’ event back.
The solution is based on this thread and available as a gist on github.

UIDatePicker Countdown mode bug and solution in Xamarin.Forms


Show hh:mm:ss picker on iOS using Xamarin.Forms.


Extend Picker view in order to achieve the next result:


First I tried to keep it simple: to give up on seconds and use UIDatePicker in UIDatePickeCountDownMode. So the end result will look like this:

I achieved it by extending the DatePicker and it’s DatePickerRenderer and changing the mode as described above. However, I discovered that ‘datePickerValueChanged’ is being called only on a second iteration with the values. The issue was successfully reproduced in Swift, so it’s not a Xamarin bug. The Swift version can be found here.
After spending some time understanding the issue described above, I found an example on StackOverflow, thanks to Mathieu who shared his solution. His example was based on XLabs, so I removed the dependency and shared it with the community.
The code can be found on GitHub.

How to debug an iOS app build in Xamarin on a real device for free?

“With Apple’s release of Xcode 7 came an important change for all iOS and Mac developers–free provisioning.”

So all you need is an apple id and to configure your IDE.
There are a lot of guides available out there, so this post is not going to be another one:
– Xamarin Developer Guide

One thing that can be confusing is that first, you need to create a Xcode project with the same “Bundle Identifier” and then download the free provisioning profile. Just pay attention to the uniqueness of your bundle identifier otherwise, it won’t work.