SMS-Biljetter 1.5 nu i Windows Phone Marketplace

Nu har version 1.5 av SMS-Biljetter till Windows Phone blivit godkänd. Bland nyheterna finns uppdaterade biljettdata för 2012 och även ett par nya städer och bussbolag, bland annat Skånetrafiken som varit väldigt efterfrågat! Nedan är hela ändringsloggen:

- Lagt till Skånetrafiken
- Lagt till Xtrafik (Gävle m.fl.)
- Lagt till Värmlandstrafik
- Uppdaterat priser och övrig information för: Uppsala stadsbussar, Uppsala regionbussar, Länstrafiken i Sörmland, Länstrafiken Örebro, Länstrafiken Västmanland, Länstrafiken Kronoberg

Appen är fortfarande gratis och kan laddas ner på Windows Phone Marketplace:


Nedan följer också lite skärmdumpar:


Free Windows Phone 7 Toolkit e-book

Today I found a new e-book, that I just have to recommend, which explains the Windows Phone 7 Toolkit in depth. It looks really good, covering most controls in detail, and giving some nice examples. This will probably be a good complement to the examples that comes with the toolkit. The book is written by Boryana Miloshevska, an experienced software developer. It can be downloaded for free here:

Update: I can also recommend the free e-book “Programming Windows Phone 7″ by Charles Petzold ( which is also a great resource for WP7 development.

Gasmackar submitted to Windows Phone marketplace

I have now submitted a new application to marketplace for certification, Gasmackar, which helps you find natural gas stations in Sweden. It shows the price and address, and allows you to easily navigate there using Bing Maps. It also features a live tile displaying the current average price for natural gas in Sweden. All information is from, a huge thanks to them for supplying the data. Below are some screenshots:


The application will soon be available in Windows Phone Marketplace. I will update with a link when it is available!

SMS-Biljetter (SMS-Tickets) 1.3 now available in WP Marketplace

SMS-Tickets 1.3 is now available in Windows Phone Marketplace. I have rewritten the whole application to improve performance, and are now also using databases to store information instead of XML files. But the main features is that it is now fully compatible with Windows Phone 7.5 (Mango). After a user request I have also added support for prefixes for phone numbers.

With mango also comes 2 sided tile support and multiple tiles, so finally you can pin your favorite tickets to the start screen and create a ticket in just one click! The live tile will on the front show which city the ticket is for. The backside will show more information as what ticket type (Adult, child, etc.), how many zones, if a prefix is used, and/or if night price is chosen.

Change log:

- Pin tickets to the start screen
- View the bus companies website right inside the app
- Add and use prefixes for phone numbers
- Support for Windows Phone 7.5
- The app is now completely free!
- Updated information about most of the bus companies
- Added the bus company “Din Tur” (Sundsvall)




Download the application here

Sok Operator (Search Carrier) is now in marketplace

My next app has now been published in marketplace! It is called “Sök Operatör” (Serach Carrier). Simply put the app shows the carrier of a specific phone number (only Swedish phone numbers). Perfect when you want to know if you can afford calling your friends! Blinkar

The app is very simple, just enter a phone number or pick one from your contacts, and press search and after a few seconds the carrier name is presented.

Here are some screenshots:




Multiple selection in Listpicker

I thought I would write a quick how-to about how to use the ListPicker for selection of multiple items.

First create a ListPicker in XAML with a few deafult strings like below:

<toolkit:ListPicker Name="myListPicker" Header="Countries" FullModeHeader="CHOOSE COUNTRIES"
SelectionChanged="myListPicker_SelectionChanged" SelectionMode="Multiple">

Notice the attribute SelectionMode=”Multiple”, which sets that the user can select multiple items, we also added an event handler for the SelectionChanged event.
Note: To use < sys:string > you need to add xmlns:sys=”clr-namespace:System;assembly=mscorlib” at the top in the < phone:PhoneApplicationPage> tag.

Now in the construct for the page, add the following code:

myListPicker.SummaryForSelectedItemsDelegate = SummarizeItems;

This assigns the function SummarizeItems to summarize the string to be shown for the selected items. Let’s create that function now:

private string SummarizeItems(IList items)
   if(items != null && items.Count > 0)
      string summarizedString = "";
      for(int i = 0; i < items.Count;i++)
         summarizedString += (string)items[i];
         // If not last item, add a comma to seperate them
         if(i != items.Count - 1)
            summarizedString += ", ";
      return summarizedString;
      return "Nothing selected";

This function gets an IList with all selected items and we just loop through them and add to a string with a comma between every selected item. Then we return the string, which will be shown when the list picker is in normal mode.

Hope you enjoyed this quick how-to!

ListPicker inside ScrollViewer WP7 Toolkit Mango

Today I was going to add a ScrollViewer to my project, the problem is that inside the ScrollViewer control I had a ListPicker. Shouldn’t be a problem, right?

But unfortunatly that seems to be a known issue in the August release of the WP7 Toolkit. To resolve this I found a solution over att the Silverlight Toolkit website that seems to work. What you have to do is edit the source of the WP7 toolkit, more precisly the file ListPicker.cs. Here is how you do it:

On line 881, change the following:

if (IsValidManipulation(e.OriginalSource, e.ManipulationOrigin.X, e.ManipulationOrigin.Y)
     && 0 < Items.Count)
   if (Open())
      e.Handled = true;

To this:

Point point = new Point(e.ManipulationOrigin.X, e.ManipulationOrigin.Y);
if (e.ManipulationContainer != e.OriginalSource)
   var trans = e.ManipulationContainer.TransformToVisual((UIElement)e.OriginalSource);
   point = trans.Transform(point);
if (IsValidManipulation(e.OriginalSource, point.X, point.Y) && 0 < Items.Count)
   if (Open())
      e.Handled = true;

Credit for this goes to Drachen23 at CodePlex.


Note: The solution also mention, to handle the Tap event of the ListPicker does not seem to work, it correctly opens the ListPicker, but does not always react when user wants to close it in Expanded Mode.

Check if user has dark or light theme in WP7 Silverlight (C#)

Thought I would share a small piece of code to check if the user is using a light or dark theme, as it seems some developers forget that you can actually have a white theme too ;)

The following piece of code will make a boolean that is true if the user has the dark theme and false if he/she has white theme:

bool darkTheme = ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible);

Then use the boolean to change the theme of your application when necessary. It is also a nice idea to make a static function you can reuse to check whether the user has dark or light theme.

Note: There is also a “PhoneLightThemeVisibility” value in Application.Current.Resources dictionary that can be used in the reversed manner from what is shown above.

Free App Hub Membership for students

Microsoft offers free App Hub memberships to students and I have seen several people ask about how this actually works. I use this myself, so I thought I would write a small guide.

- First, go to the Dreamspark WP7 webpage and press the “Sign In” button. Then sign in using your Live ID, or create a new one if you don’t got one yet.

- Then press the Verify Link in the left column of the website or click here. This brings up the verification page. Choose the country of your school, then check “Verify as a Student”, and finally check “Get verified through my school”. Then press “Continue”.

- On the next page select your school and press “Continue”. You will now be brought to your schools login page, where you login using your school credentials. When you done that you are verified as a Student.

- Next step is to navigate to the App Hub website, and sign in. When you have signed in, you will be brought to the registration page. Select “Student” as account type, and now follow the instructions on the website. When you are done you have a free app hub membership!

The student membership is ALMOST like a normal substruction, with the exception that you can only debug Xbox-360 games and not sell them. For Windows Phone 7 apps and games, you can both debug and sell them in the marketplace. So for WP7 development it is ideal!

Ok, so I got my app hub membership, but how do I developer unlock my phone?
This is another question I heard a few times. To unlock your phone, you will need to verify your App Hub account, for student accounts this process wont start until you submit an application to the WP7 marketplace, ironically enough. So make a dummy application in Visual Studio and submit it to WP7 Marketplace. After a few hours/days you will get an email from GeoTrust with details on how to verify your account. This process might take a few days.

When your account is verified, run the program “Windows Phone Developer Registration” that comes with the WP7 developer tools and follow the instructions there to unlock the phone.

Using AdMob in WP7 Silverlight Applications

I recently read that Google released a beta for AdMob in WP7 apps. That was great news for developers like me that can’t use Microsoft pubCenter that is US only. So I thought as a first real post here I would write a little tutorial on getting started with the SDK.

Download and install the SDK
First you have to create an account at (or login using an existing account) and add a new WP7 app to the AdMob account. You will then be presented with the link to download the AdMob WP7 SDK.

Add references
First off, add a reference to “Google.AdMob.Ads.WindowsPhone7.dll” that came with the SDK.

Add reference

In your XAML file add the following two namespace declaration at the top:


Add the BannerAd control
To add the Ad Control, just add the following piece of code:

<google:BannerAd Name="MyAd" AdUnitID="n50g7fd69132t92" />

The AdUnitID is your Publisher ID presented on the AdMob website. If you run the project you will now get an ad shown. (No that is not my publisher ID )

Run AdMob in test mode
But to avoid getting impression counted while developing the application you might want to use test ads, you can do that by changing the ad code to:

<google:BannerAd Name="MyAd" AdUnitID="n50g7fd69132t92">

(I will show how to get the Device ID in my next post.)

The result
And here is the result of our not so hard work.

AdMob in action

AdMob in action

You are now up and running with Google AdMob in your application! Now go make some money ;)