Want to meet the Cimbalino Windows Phone Toolkit?

The next W&W WAG (Wales and West Windows Application Group) meeting will be help tomorrow, February 26th, at Nokia Bristol office, and will feature me talking about the Cimbalino Windows Phone Toolkit, and the Mike Hole, talking about Bluetooth and NFC based communication.

The meeting will start at 18h30, you can find more details and register here!

Hope to see you there! :)

Disabling screenshot functionality in a Windows Phone app

Update: Kudos to Murat and Rudy Huyn for pointing me out on a missing return; that would cause the NotSupportedException to be raised all the time… I’ve fixed the code by inverting the if condition.

Update 2: Just noticed that GDR2 is also supported, as the code below will also work in devices with it! :)

Windows Phone 8 made it possible to take a screenshot of your screen at any time, just by pressing the Windows and Power button at the same time.

Sure, this is a really cool feature and can be quite handy from time to time, but it can become a security concern for some specific scenarios, not to mention a way to copy someone else’s graphical designs!

Since Windows Phone 8 update 3 (GDR2) there is now a hidden feature that allows you to disable the Screenshot functionality on a page by page basis: the PhoneApplicationPage.IsScreenCaptureEnabled!

This is a hidden property that requires Reflection in order to access and modify it’s state. The following extension methods will help you with that:

public static class PhoneApplicationPageExtensionMethods
public static bool CanSetScreenCaptureEnabled(this PhoneApplicationPage page)
return Environment.OSVersion.Version >= new Version(8, 0, 10322);
public static void SetScreenCaptureEnabled(this PhoneApplicationPage page, bool enabled)
var propertyInfo = typeof(PhoneApplicationPage).GetProperty("IsScreenCaptureEnabled");
if (propertyInfo == null)
throw new NotSupportedException("Not supported in this Windows Phone version!");
propertyInfo.SetValue(page, enabled);
public static bool GetScreenCaptureEnabled(this PhoneApplicationPage page)
var propertyInfo = typeof(PhoneApplicationPage).GetProperty("IsScreenCaptureEnabled");
if (propertyInfo == null)
throw new NotSupportedException("Not supported in this Windows Phone version!");
return (bool)propertyInfo.GetValue(page);

The first step is to call CanSetScreenCaptureEnabled() from inside your PhoneApplicationPage to check if the Windows Phone version is at least Windows Phone 8 update 3 (version 8.0.10322) as that is the minimum required version for this to work!

If it is, we can then use the GetScreenCaptureEnabled() and SetScreenCaptureEnabled() extension methods to change the property value!

Here is a sample usage code to disable screenshot functionality:

public partial class MainPage : PhoneApplicationPage
public MainPage()
if (this.CanSetScreenCaptureEnabled())

If you do try to take a screenshot after that code, this is what will happen:

Application screenshot functionality disabled

The same result will happen from the application switcher screen:

Task switcher screenshot functionality disabled

Nowadays, privacy has become the #1 concern in everything we do, and I’m sure this is a really useful information for a bunch of apps out there (looking at you 6snap and all other Snapchat apps ;) )

The Windows Phone apps on my phone!

So you got a brand new Windows Phone device for Christmas and still don’t know what to install on it?

Then look no further: here is the list of the best apps I have installed on my own phone! :)


  • Twitter - The fully featured Twitter app with multiple account support and push notifications that actually do work!
  • Facebook Beta - There is also a non-beta Facebook official app, but I prefer the beta one as it gives me the latest features sooner! ;)
  • 4th & Mayor - I know that there is an official Foursquare app and that it’s a lot better than the first version, but I still prefer 4th & Mayor from Jeff Wilcox as it is quite simpler and uses a more direct approach!
  • WhatsApp - free messaging that works on pretty much any phone? Yes, thank you very much! :)
  • Skype - The official Skype app, really good when it actually works… this is the one app I really need and sometimes fails me miserably :\
  • 6tag - developed by Rudy Huyn, probably the best Instagram app for Windows Phone. There is an official Instagram BETA app, but it’s still lacking some features…
  • Disqus - It’s probably the most used network for commenting on forums and blogs everywhere!
  • LinkedIn - LinkedIn official app, to keep in eye on your professional connections.
  • Viber - Another VOIP app, quite known out there

Tools + Productivity

  • Authenticator - In a time where security and privacy are lacking more and more, using two-factor sign-in whenever possible does help a bit (Microsoft, Google, and other websites use this approach)
  • Google - not that different than accessing www.google.com with the browser, but nevertheless it’s the only app that Google has on Windows Phone…
  • Adobe Reader - Official Adobe Reader app to open PDF files on the phone. There is also a PDF Reader from Microsoft as a really good alternative.
  • BoxFiles for Dropbox - There are quite a few Dropbox apps right now for Windows Phone (none is official) and I personally like this one.
  • SkyDrive - full featured official SkyDrive app from Microsoft.
  • GDrive - Using Google Drive? Then this is what you need! It’s not a fully featured client, but at least it is better than nothing!
  • TeamViewer - Access your machine remotely using TeamViewer.

News + Weather

  • Nextgen Reader - this is the #1 app in my phone!!! I just couldn’t go by without reading my RSS feeds, and given it uses Feedly as source, all my feeds are synchronized; just perfect!!
  • Amazing Weather HD - A really good weather app with nice look and quite a few features. A free alternative is Bing Weather, also quite nice!

Lifestyle / Shopping

  • Amazon Mobile - Search Amazon, purchase stuff, check your order status…
  • eBay - The app is quite simple and could use a better look, but it works well and does a proper job alerting when auctions are about to end.

Travel + Navigation

  • Geosense - quite useful to convert from different GPS coordinates types, to get my location, open KML files from Google Earth… and yes, I wrote it and that’s also another reason why it’s here, so sue me! :P
  • TripAdvisor - I always like to read the reviews on hotels and restaurants on TripAdvisor before I actually go to the place.
  • Currency - Currency exchange, provided by XE


  • IMDb - The official IMDb app for Windows Phone, probably the best showcase for a WP app and the best IMDb client you’ll find in any mobile device!
  • Helium Voice Free - Because it’s fun and I like to show kids! :)


  • Office Remote - do you do PowerPoint presentations? Then do yourself a favor and install this in your Windows Phone!

Personal Finance

  • PayPal - I like to keep a close eye on my PayPal transactions!


  • Pictures Lab - Nice, clean, and fast, picture effects app, developed by René Schulte.
  • Tile Me! - Create a Windows Phone tile picture with this app, and use it everywhere! :D

Music + Video

  • YouTube - a couple a months ago there was an official YouTube app (and it was really good, I might add), but Google pulled the plug on it and so we are stuck with just this miserable plugin and YouTube mobile website…
  • Shazam - You know when you’re in a party, listening to a music that you actually like and don’t know who the artist is? That’s when Shazam comes quite handy!
  • Sax - A simple fun way of playing saxophone without one!

Books + Reference

  • Wikipedia - it’s Wikipedia, and that is all anyone needs for reference…

So go on now, install some apps in your phone and have fun!

And by the way: Happy New Year!!! :)

Creating PNG image files in Windows Phone

Windows Phone image processing and format support has always been lacking a bit, especially when compared with all the GDI+ capabilities one has available in the full .NET Framework.

For instance, you can read JPEG and PNG files, but you can only save to JPEG, as there is no support to save to PNG directly on the platform.

Saving to PNG has been quite easy since the beginning of Windows Phone 7 by using 3rd party libraries, and on this chapter, .NET Image Tools is the most used one!

But personally, using Image Tools always presented two major problems:

  • it requires SharpZipLib (a GPL licensed library) to handle Zlib compression
  • it’s quite slow and uses a lot of memory

The first problem is a definitive “no-no” for usage in closed code commercial apps, as GPL is ”viral license

The second problem is more related to the way Image Tools was developed, not considering usage in mobile devices that have lower specifications as to processor capacity or memory.

The Cimbalino Windows Phone Toolkit way

Cimbalino Windows Phone Toolkit version 3.2.0 presents a new WriteableBitmapExtensions containing a SavePng() method to create PNG files from WriteableBitmap instances!

Internally it uses DotNetZip (Ms-Pl license) to handle the required ZLib compression and it’s quite optimized for speed and low memory consumption.

To illustrate the speed improvement, Ertay Shashko was kind enough to test it with his Tile Me app, and here are the results of his personal usage:

I guess the numbers speak for themselves! :)

Handle 1080p in Windows Phone like a Pro!

The change log for Windows Phone 8 update 3 (also known as GDR3) has been known for a few weeks and one of the new features is the added

support for bigger, higher-resolution screens

This is obviously only for new devices, with 5” or 6” screens using 1080p resolution, like the amazing Nokia Lumia 1520!

Here’s the complete list of Windows Phone supported resolutions, divided by aspect ratio:

  • 15:9
    • WVGA (480x800, 1.0x scale factor) - this is the only resolution available in WP7
    • WXGA (768x1280, 1.6x scale factor)
  • 16:9
    • 720p (720x1280, 1.5x scale factor)
    • 1080p (1080x1920, 2.25x scale factor) - only supported in the new large screen devices with WP8 update 3

As a Windows Phone developer/designer, you don’t need to know this!

All you need to do is design the interface in XAML for the 480x800 resolution, and it will automatically scale up using a fixed scale factor! How cool is that? :)

Now if you really want to know what is the device scale factor (maybe to create different app resolution-aware layouts), you can read the Application.Current.Host.Content.ScaleFactor (note: this property will return the scale factor * 100).

But there’s a catch: for the new 1080p devices, the scale factor is returned as 1.5x, just as the 720p devices, instead of the correct 2.25x…

To get the real scale factor, you can use the following code snippet:

public int ScaleFactor
object physicalScreenResolutionObject;
if (DeviceExtendedProperties.TryGetValue("PhysicalScreenResolution", out physicalScreenResolutionObject))
var physicalScreenResolution = (Size)physicalScreenResolutionObject;
return (int)(physicalScreenResolution.Width / 4.8);
return Application.Current.Host.Content.ScaleFactor;

In WP8 update 3 you can use DeviceExtendedProperties.TryGetValue("PhysicalScreenResolution", out physicalScreenResolutionObject) to retrieve the screen Size resolution in pixels, take the Width of it and divide it by 4.8 to know the correct scale factor.

If the call to DeviceExtendedProperties.TryGetValue fails it just means you don’t have a WP8 GDR3 device, and as such the device is not a 1080p device and you can just fallback to use the Application.Current.Host.Content.ScaleFactor approach!

The Cimbalino Windows Phone Toolkit way

Previous versions of Cimbalino Windows Phone Toolkit already had the IScreenInfoService to help handling this, and since version 3.2.0, you can also count on the added 1080p support! :)

Cimbalino Windows Phone Toolkit Updated to v3.2.0

Version 3.2.0 of Cimbalino Windows Phone Toolkit is now available!

This release is mostly a bug/performance fix; here’s the change log:

  • Added the WriteableBitmapExtensions, which provides a high-performance & low memory impact SavePng() method!
  • Improved the IScreenInfoService and ResolutionAwareUriConverter to contemplate 1080p screens
  • The usual improvements and bug fixes

Windows Phone Week

Windows Phone Week

Directly from the official site:

Windows Phone Week is a series of events created for the developer community by Windows Phone Developer MVPs.

The events are in nine countries, encouraging developers from around the world to explore app and gaming development.

Each event has a unique agenda, format and registration process so please check the details at the location nearest you.

Although at this stage only 9 countries are participating, there are plans to expand to other territories, so stay tuned! ;)

Windows Phone URI association deep links and the ampersand

A few weeks ago I stumbled on an issue while using ampersand (&) in a URI association deep link with query string parameters!

Let’s start by assuming I have a Windows Phone app capable of handling deep links with “my-app:” moniker. Now take a look at the following sample link:


We can easily see a query string with two parameters, and after decoding their values, we get param1 = "a&b" and param2 = "c".

If we use the Launcher.LaunchUriAsync(uri) method to open the link, this is what will arrive in the internal UriMapper:


By retrieving and decoding the encodedLaunchUri from the previous link, the result will be "my-app://do/stuff/?param1=a%26b&param2=c", matching the original uri, as we would expect!

If we now use a web page with that link on it instead, open the page inside Internet Explorer on the phone and tap on the link, this is what will get to the app UriMapper:


If we do as before and retrieve and decode the encodedLaunchUri, we will get "my-app://do/stuff/?param1=a&b&param2=c", which in this case, doesn’t match the original deep link!

This behavior is due to Internet Explorer in Windows Phone, as it seems to decode all links before trying to navigate to them, and when it can’t perform the navigation (e.g. when the link isn’t a http:// or https:// link) it just sends it to the platform to handle it, but by that time the link has already been wrongly re-encoded!

So far I haven’t been able to find any way of bypassing this issue, apart of simply not using the & in my apps deep links… and my advice to you is to proceed just like this!