Getting Started With Windows Phone Development

Going to a lot of local events I always get asked “what do I have to do to get started to create an app on Windows Phone?”  I noticed I have never put together a getting started article so here it goes.

Basically, the only URL I give everyone is which is App Hub.

Here developers will find everything they need to get started including tools and registration process to publish your apps.  The biggest shock to most people are that all tools are free so it costs you nothing to get started and the only cost is when you are ready to submit your application for certification into the Windows Phone Marketplace.  The cost is $100/yr for an AppHub membership similar to the Apple AppStore pricing.

There are also some targeted Microsoft programs that devs can take advantage of not just for Windows Phone but for all MSFT based software. Continue reading Getting Started With Windows Phone Development

The Share Icon on Windows Phone

I recently wrote about the different ‘share icons’ that are being used on various mobile platform but one that really stands out (and not in a good way) is the Windows Phone icon.  The Windows Phone icon looks like this

A gift or present image.  Now I guess it could mean ‘share’ or ‘give something to someone’ and in our case would mean ‘giving them a link to some content’ but using a ‘gift’ as a share icon didn’t make sense to me but because I believe in using what is provided in the platform, I went with the standard icon, until now. Continue reading The Share Icon on Windows Phone

Windows Phone and Database Support Part 2

Back in June, I did a few blog posts on Windows Phone 7.1 SDK and some new features for developers.   I also did one specifically on Windows Phone and database support as this was a huge pain point for developers including myself.  Well with Windows Phone 7.5, things are a lot better.  I’ll quickly go through how to get a database up and running, access the data and update the data.

For this sample, we’ll be creating a quick application to track kilometers for a car. We are basically going to have a Car class, and a car will have a collection of Kilometer Entry Items.

Creating our Model

Creating your via code is a manual process, unlike the desktop devs, we don’t have a designer, although I would imagine you could generate the code with the desktop tools and then modify the generated code.  I’ll take the long way as you have more control and see what is going on and so you learn more IMO. First we have to create our model and will essentially look like this (NOTE: This is not an extensive Kilometer tracking application, just a sample, feel free to extend, make better and sell on marketplaceSmile) Continue reading Windows Phone and Database Support Part 2

Nokia, Windows Phone and the Smartphone Battles

8f336_windowsphone_logoBack in August, Google announced that they are buying Motorola for $12.5billion.  Great buy on Google’s part because it will somewhat help defend them in the patent issues they are currently facing with Android and OEMs using Android. Will this help $GOOG win the smart phone battle? Don’t know, but they are sure taking a large chunk of the market!

What does this mean for Windows Phone?  Don’t know either, but they do have Nokia; which used to have the largest marketshare, on board to deliver Windows Phone based hardware.  Unfortunately they have been steadily losing a very large chunk of their marketshare.  Over a year ago I did write an article on whether Windows Phone will succeed, and over all I think it is doing pretty well considering it started from scratch again (Yes I’m optimistic Smile) but don’t think it has been fully successful yet.

Nokia-800-BlueNow will Nokia hardware help $MSFT get marketshare for Windows Phone?  I think it will as it has a history of making some pretty sexy devices.  The image here is supposedly of the Nokia 800 when it’s going to release this year (image courtesy of PocketNow)

Interestingly enough, Barranger (or @4MKMobile) talks about his experience with Nokia X7 and N8 during an event he attended and summarizes his reason Why Nokia coming to Windows Phone is a huge deal. Continue reading Nokia, Windows Phone and the Smartphone Battles

TechDays 2011 & Windows Phone


TechDays is fast approaching and is next week in Toronto.  Similar to past years (2008, 2009, 2010) I’ll be presenting on Windows Phone.  This year is great because I finally think Windows Phone is in a state where consumers will finally start paying attention and the competition is actually starting to copy features in Windows Phone (who would have ever thought that!)

This year TechDays will be taking place in the following cities so make sure to register

  1. Toronto – October 25-26
  2. Vancouver – November 15-16
  3. Montreal – November 29-30

If you do register for TechDays 2011, make sure you use this promo code TDSPKR11CAN to get 50% off the conference admission! Continue reading TechDays 2011 & Windows Phone

Windows Phone 7.5 App Challenge

Calling all Canadian Developers, win a brand new Windows Phone 7.5 phone if you build 2 quality apps.

If you’re one of the first 300 to build or upgrade 2 quality apps in the Mango App Challenge, and Microsoft will give you a free Windows Phone 7.5 phone, plus showcase your apps to over 40,000 developers in newsletters and other Microsoft properties.

Make sure you read the Windows Phone quality check list for the app challenge as it will be some of the criteria.

  1. Design
  2. Usability
  3. Stability
  4. Engagement
  5. Sociability
  6. Cloud Integration Continue reading Windows Phone 7.5 App Challenge

Quick Tip: Theme Aware Icons

In a previous post I talked about how sometimes when selecting text when cutting and pasting on Windows Phone, the text might not be visible because the brushes where changed potentially leading to unreadable text.

Another issue I have encountered is when dealing with images.  Sometimes your design calls for adding metro style icons to your page instead of using the Application Bar which is fine, but as developers, we have to be aware that Windows Phone provides both Light and Dark backgrounds when a user customizes their Theme.  This can lead to some undesirable experiences for the user.

The Wrong Way
The first way most will go about and do it is by using an image on a button.  For example, lets say you have a button with an email icon on it as follows.


All looks good, but what happens when the user switches to the Light Background?  Using the Device Tab in Expression Blend, we can easily switch the background color and see that the icon is no longer visible.


Switching to Light results in the following


You’ll notice the button border is still visible, but our icon is not anymore.

How to fix?
The easiest way I find to fix this is by using paths.  With Expression Blend you can either create your own paths or import Adobe Illustrator or Photoshop files into your page.  If you like you can create the paths manually, but that can be a little of tedious process so the importing feature comes in handy!


So if we select the ‘email icon’ available, we will get the following path in XAML which essential translates to the email icon

<Path Data="F1M372.2549,480.7969L372.2549,470.1369L380.8289,476.8239C381.0519,476.9959,
476.8259L391.2659,469.9019L391.2659,480.7969z M390.6919,467.2499L381.5849,474.3089L372.5359,
467.2499z M392.4859,464.8029L371.0289,464.8029C370.3559,464.8029,369.8089,465.3499,
Fill="Black" Height="18.441" Stretch="Fill" Width="23.903" HorizontalAlignment="Right"
Grid.Row="1" UseLayoutRounding="False" VerticalAlignment="Top"/>

So now to make the path visible in either theme, you will have to set the Fill Property of the path to PhoneForegroundBrush.


Add this path as the ‘Content’ of your button instead of the image, and when switching themes, the path will visible in either Light or Dark background color as follows



Why Bother?

For me there are two reasons to bother.  First one being user experience.  If your images disappear because of user settings, it’s not the best experience and doesn’t make for a professional looking app.  The second reason, your app may fail certification if this happens.  The Windows Phone Marketplace ingestion team does look at theme awareness making sure apps adhere to themes on the device.  We did fail one app once because of images disappearing (this is why I’m sharing this tip Smile) so make sure you test in both Light and Dark backgrounds.

Hopefully this tip helps you, moral of the story is test your application in both the Light and Dark backgrounds to bring that right user experience and hopefully not get stung by this on marketplace cert testing.

Screen Capture on Windows Phone 7

In some instances when working on projects we would require to take a screen capture of the current screen the user is working on.  I regularly did this on .NET Compact Framework 3.5 (pre Windows Phone 7) and is a little bit of mess because of all the PInvokes involved. 

I decided to create a quick sample app that captures the screen on both platforms to compare the code.  The sample app basically just places the captured screen inside a pictureBox control (NETCF 3.5) or Image control (Silverlight for WP7).  The outer PictureBox/Image control just displays some standard images that come with Windows 7.

Compact Framework 3.5   Silverlight (Windows Phone 7)
image   image

Here is a comparison of capture an image of the current screen on Windows Phone 7 using Silverlight and .NET Compact Framework

.NET Compact Framework

private Bitmap CaptureScreen()
    Bitmap b = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
    using (Graphics g = Graphics.FromImage(b))
        IntPtr hdcSrc = IntPtr.Zero;
        IntPtr hdcDest = g.GetHdc();
            //get the entire window by passing in IntPtr.Zero
            hdcSrc = GetWindowDC(IntPtr.Zero);
            //blit to the graphics object g
            BitBlt(hdcDest, 0, 0, b.Width, b.Height, 
                hdcSrc, 0, 0, SRCCOPY); 
            //Release any native src hdcs
            if (hdcSrc != IntPtr.Zero)

            //Release the graphics hdc

    return b;

public static extern IntPtr GetWindowDC(IntPtr hWnd);

public static extern int DeleteDC(IntPtr hdc);

internal static extern IntPtr ReleaseDC(IntPtr hdc);

public const int SRCCOPY = 0x00CC0020;

public static extern bool BitBlt(IntPtr hdcDest, 
    int nXDest, int nYDest, int nWidth, 
    int nHeight, IntPtr hdcSrc, int nXSrc, 
    int nYSrc, uint dwROP);

Windows Phone 7 using Silverlight

private void btnCaptureScreen_Click(object sender, RoutedEventArgs e)
    //Capture the screen and set it to the internal picture box
    WriteableBitmap bmp = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);
    bmp.Render(this, null);
    this.image1.Source = bmp;
    //Set a new background
    ImageBrush brush = new ImageBrush();
    brush.ImageSource = new BitmapImage(new Uri(NextImage,UriKind.Relative));
    ContentGrid.Background = brush;

Essentially the apps do the same thing but it’s a lot easier to do it on one than the other.  Here are some quick highlights on the differences.

  1. Silverlight for Windows Phone 7 has 7 lines of code while the .NET Compact Framework version has 28 lines of code
  2. With Silverlight for Windows Phone 7 you don’t have to deal with PInvokes anymore.
  3. Windows Phone 7 codebase is a lot smaller and more maintainable.
  4. With silverlight for Windows Phone 7, controls automatically support transparencies which was a challenge on NETCF 3.5 (notice the white box on NETCF 3.5 screen, that’s a PictureBox control
  5. Currently on Windows Phone 7 there is no way to get the images from your device in the form of a file unless you upload to a web service or something similar

Give it a try for yourself and download the sample code here.

EnergizeIT: From the Client to the Cloud – The Mobile App

I few months ago RedBit was asked by Microsoft to help them create a Windows Phone 6.5 demo application for EnergizeIT: From the Client to the Cloud tour across Canada. 

The purpose of the mobile software was to allow a fictitious insurance company to AppLogo_Splash_VGA_thumb[7] collect car accident information from a consumer. The consumer would be able to fill in basic information about the accident, take pictures of the incident, get the GPS location including address of the accident and submit this to a backend system where the data can be collected and acted upon.  The goal was to show EnergizeIT attendees how to leverage the Microsoft based platform and tools such as Silverlight, .NET 4.0, Azure and Visual Studio 2010.  The mobile software used .NET Compact Framework 3.5 but I’ll have a future post on porting it to Windows Phone 7.

RedBit’s role was to get the data from the Windows Phone to the backend database.  Our goal was also to make the mobile app look a little nicer than traditional Windows Mobil apps. What we created is a mobile client to have the consumer enter accident information and also created a WCF service to allow consumers to submit the data for the insurance company to act on. 

image image image

For location support we created a WCF service to reverse geocode a location to provide a readable address and an image of the location via Bing Maps API.

image image

The user would also be able to see their insurance card and the autos that are insured cars under their policy.

image image

We also included a feature called On The Road that allowed you to search for various services around you. 

imageBy the way, you can download Find My Bru from Windows Phone Marketplace now.

Overall, I think we were able to deliver a pretty good looking functional app on Windows Phone 6.5 (with a lot of effort for the UI).  Thanks to Christian Beauclair and the rest of the Canadian DPE team for giving us the opportunity to build this app for Windows Phone. 

Unfortunately, I won’t be publishing the source to this app but will be following up on blog posts showing some code snippets that I think will be useful to the developer community. 

I’ll also be following up in another blog post on porting this mobile application to Windows Phone 7 and what code we were able to re-use and most importantly, how easy it is to make a good looking app on Windows Phone 7.

If you want more info on the app please feel free to contact us at info[@]redbitdev[dot]com

Win A Car with MuchMusic and Windows Phone

I recently wrote about the Much On Demand (or MOD for short) application for Windows phone

If you are a resident of Canada, you have a chance to win some great prizes from a 2009 Mitsubishi Lancer to  Samsung Omnia II Windows Phones, Samsung Cameras, camcorders and netbooks!! 

How do you win?  Watch Holiday Wraps programs on MuchMusic on the local cable or satellite channel in your area from Sunday, December 13, 2009 to Sunday, January 03, 2010 and lock for this contest clue.


Enter your clues and you could win!  While your at it, don’t forget to download  MOD for Windows Phone!