Sorted lists in Windows 8 applications

While developing Windows 8 applications I have come across the requirement to have my list of items sorted on my screen, sometimes in a <ListBox>. Unfortunately the base WinRT controls make this really difficult to achieve.

After a few hours of searching for an easier way to do it, I finally discovered a way of sorting the items. Rather than having the controls automatically sort for me (as I was used to doing in Silverlight, etc.), but instead by sorting the underlying list itself. It makes total sense in hindsight.

A blog post from Andrea Boschin explains how to do it:

The sorting can be achieved automatically by overriding a method in the ObservableCollection. The final step is to add the IComparable interface to the class you want to sort.

Here is an example IComparable implementation that will sort alphabetically

public int CompareTo(object obj)
var person = obj as Person;
return string.CompareOrdinal(this.Name, person.Name);

By David Burela
Reblogged from my 
Infragistics blog

Adding a privacy policy to your Windows 8 application

One aspect of Windows 8 app development that I have seen a lot of developers get tripped up on has been the inclusion of a “privacy policy”. The certification requirements document explains why it is needed:

But to sum the article up, if you even have the “can access the internet” capability checked then you MUST have a privacy policy. I (incorrectly) thought that since I was just accessing a XML feed and not sending any data that I would be excluded from the requirement. But Microsoft have no idea what you may be sending in your GET/POST requests.

Examples of privacy policies

The first step is to write a privacy policy, however it is probably easier to just base yours off of someone else’s. Here is my current privacy policy

Here are links to a few other privacy policies:

The next hurdle is finding somewhere to host your privacy policy. You could use a free Windows Azure website account, post it onto your blog (like I have done), or perhaps put it onto skydrive/dropbox and make it public.


Once you have your privacy policy, the last step is to add it to the settings charm. The easiest way is to add it to the settings charm from App.xaml.cs, this way the privacy policy is available on every page of your application.

Below I have included the code snippet I use in my own code. First you add an event handler for when the commands are requested. Then you add your new privacy policy option to the settings screen. Finally you add logic for what happens when your new option is clicked (launch the web browser).


protected override void OnLaunched(LaunchActivatedEventArgs args)
// …

SettingsPane.GetForCurrentView().CommandsRequested += App_CommandsRequested;

void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
args.Request.ApplicationCommands.Add(new SettingsCommand(“privacypolicy”, “Privacy policy”, OpenPrivacyPolicy));

private async void OpenPrivacyPolicy(IUICommand command)
var uri = new Uri(“”);
await Launcher.LaunchUriAsync(uri);

I hope this helps simplify your app development!

By David Burela
Reblogged from my
Infragistics blog.