InTheHand.UI v9.0

I’ve updated InTheHand on NuGet and added the accompanying library containing UI functionality (InTheHand.UI). The main shared piece of functionality here is the MessageDialog (ala Windows.UI.Popups) and this works across all the Windows platforms (Including Windows Phone Silverlight) and iOS and Android. The appearance of the dialog is as the native experience with one exception…


We noticed on Windows 10 that the appearance of MessageDialog changed for our 8.1 app, rather than being a band across the width of the screen it was now a true floating window in its own right but this had one negative aspect – the title text appeared twice on the dialog. Users reported this as confusing and there is currently no workaround directly. In UWP apps there is now a ContentDialog control which is used for popping up content with up to two action buttons (you may recall this from Windows Phone 8.1) and so our implementation wraps this API on Windows 10 Desktop while exposing a single MessageDialog API. To avoid breaking the API we currently fall back to the system MessageDialog if you use three Commands. You can see a taste of the various flavours below:-


The other functionality within InTheHand.UI is currently specific to Windows flavours and I’ll be discussing it in a future post.

Build Charming Apps v9.0 Preview

With the impending release of Windows 10 I set about updating the Charming Apps libraries to support UWP targets and it soon became painfully clear that things had got too complicated. There was a separate dll for each small area of functionality and various dependencies and 17 NuGet packages to manage (each with multiple platforms).

Version 9 is a reboot of the project and currently consists of just two packages – InTheHand.dll and InTheHand.UI.dll. The first of these is now live on NuGet in preview form and replaces a number of old libraries and adds new stuff! During the MVP Summit I was able to spend the Hackathon rebuilding my development environment and refactoring the entire solution.

The API follows the UWP model where possible, making it familiar to Windows developers while extending both backwards to prior Windows versions and also sideways to Xamarin platforms. Also new in Version 9 is a PCL build which allows you to call the shared functionality from a PCL with the functionality itself provided by the platform specific dll in the consuming application. This is useful in scenarios such as Xamarin Forms projects.

For example InTheHand.ApplicationModel.Package provides a mechanism to query the current application package for name/version etc. This is the sort of information you might need for a custom About page or to pass to analytics etc. The InTheHand.ApplicationModel.DataTransfer namespace contains Clipboard and Sharing functionality which now supports Android and iOS too invoking the native experiences in each. The remainder of the InTheHand.ApplicationModel namespaces allow you to kick off a number of tasks such as SMS, Email etc. Other namespaces exist for querying display properties and battery state.

All the code is on GitHub and a very rudimentary version of documentation is in the project Wiki. Most of the documentation in CodePlex still applies too and will be migrated in due course.

Coming in the InTheHand.UI package are InTheHand.UI.Popups (MessageDialog) and InTheHand.UI.ApplicationSettings (currently Windows platforms only) both of which have some neat Windows 10 specific tweaks.

Self Installation of Hive

Installing the Hive hardware was straight-forward because my existing controller had a standard backplate and so I didn’t have to change any wiring. The trouble came when trying to setup an account because when you ring the number on the included voucher no-one seems to understand the process for self-installed units. After I eventually got it sorted I was told there is an alternative way which doesn’t involve going round in circles with various sales/tech support etc phone lines:-

When you order from Amazon there is a voucher code on the box. If then visit and enter the voucher code in. It will then allow you to create an online account.

This should have been included with the voucher code because it seems a much more straight-forward approach. Unfortunately before I could use this I was already setup but I’m pinning it here for reference.

WinRT specific properties in Xamarin Forms XAML

Xamarin Forms originally supported iOS, Android and Windows Phone Silverlight applications. The OnPlatform<T> class provides a mechanism for putting values directly into your XAML which are dependent on the host platform. This is often necessary to cope with different screen sizes and scaling behaviour across platforms. When Windows 8.1 and Windows Phone 8.1 were later added the OnPlatform class was not updated. This means that if you use OnPlatform it can’t provide a value for WinRT platforms. Without resorting to changing properties in the code-behind we wanted a way to set platform specific property values from XAML. Luckily the solution was quite simple – just 55 lines of code including doc comments and I’ve published the code here:-

To use in your XAML you just need to add an XML namespace declaration to your root node (e.g. ContentPage)


Then use the class from your XAML. It works with any type which can be represented as a string in XAML. e.g.

   <forms:OnPlatform2 x:TypeArguments="Thickness" iOS="5" Android="5" Windows="0,10,0,5"/>

Xamarin Forms Maps on Windows Phone 8.1

Some time ago Xamarin added support for Windows Phone 8.1 (and Windows 8.1) platforms to Xamarin Forms. I wrote a blog post about how to configure your project to run your Xamarin Forms app in a Windows Phone 8.1 project.

Alongside the base Xamarin Forms API there is a Xamarin Forms Maps component which, as the name suggests, adds cross-platform mapping support for Xamarin Forms applications. However there is a catch, in the current version (1.5 at the time of writing this) only Windows Phone Silverlight is supported. So while you can target Windows Phone 8.1 with Xamarin Forms you can’t use the Xamarin Forms Maps functionality.

With most controls there is a standard way to write a custom renderer to provide an implementation for a particular platform. Quite often these are not too complex – just mapping properties from a Xamarin Forms control to the native equivalent. Windows Phone 8.1 has a Map control built in so I set about writing a renderer.

It wasn’t quite as straight-forward as I originally anticipated and it took a while to work out what the other platform implementations were doing but I got it to a point where 99% of the functionality is supported so decided to release the code (on GitHub here) and the compiled library (on NuGet here).


You can get up and running very quickly. You merely need to add the NuGet package to your Windows Phone 8.1 project and add one line of code:-


Place this in the OnLaunched method in your App.xaml.cs file. [MAP_TOKEN] is a string which you can get for your app from the Windows Dev Center. For debugging/test purposes you can pass null here and the map will display a banner indicating it is running without a token. I designed this to be as similar as possible as the other Xamarin.Forms.Maps platforms. Only the namespace is different. No changes are necessary to your PCL project to support this.


There is a sample app in the GitHub repository which adds some food and drink pushpins to Birmingham. This is how it looks on Windows Phone:-

MapsTest on Windows Phone Emulator
MapsTest on Windows Phone Emulator

As well as supporting the Map control itself the library also provides an implementation for the Geocoder class. This allows you to fetch an address (or addresses) for a given position or to lookup a location for a given address. I haven’t currently added this to the sample project, but there is nothing special to do here – it “just works” from your platform independent code.

What’s Not In This Version

The only real thing I didn’t put into this version was the ability to use different pushpin icons depending on the type of PushPin – Xamarin supports Generic, Place, SavedPin and SearchResult. All currently use the default image which you can see from the above screenshot.


My last word is to say thanks to those who offered to test this and provided feedback on the initial build. I hope you’ll find this useful to easily add mapping to your Xamarin Forms projects on Windows Phone.

Xamarin Forms Password Entry on Windows Runtime

Xamarin Forms doesn’t have a specific PasswordBox control – instead you use the Entry (Think TextBox) and set IsPassword to true. Normally this works as expected and provides a masked entry box. However there is a known issue on Windows Runtime (Phone and Desktop) where AutoSuggest and Auto Capitalisation are not disabled for a Password field. Luckily there is a workaround which is to set the input keyboard to Email. The small side effect is the addition of a “.com” button to the keyboard but it will stop the control capitalising the first letter or showing suggestions based on what you are typing. I added the following code behind:-

if(Device.OS == TargetPlatform.Windows)
   txtPassword.Keyboard = Keyboard.Email;

This issue doesn’t affect Silverlight apps (TargetPlatform.WinPhone) and I decided not to set the keyboard on other platforms as they work correctly with the default keyboard.

Microsoft Windows Platform Development MVP


Get every new post delivered to your Inbox.

Join 709 other followers