Windows Phone 7 Developer Tools CTP - simple app and first impressions

Very pleasant XAML editing/design experience, unbearable deployment wait time.

Creating the project, opening the designer and adding/changing a few lines - initial impression was definitely positive - the XAML designer updates immediately, IntelliSense is working as expected. I even tried dragging something from the toolbox (something I haven't in a while with WPF, knowing it's often safer and always faster to just type it in) and it 'just worked'.

VS 2010 Express for Windows Phone CTP

Well, unfortunately, despite having been impressed with IDE experience and designer responsiveness, eventually I ended up writing my  and testing application as a regular Silverlight project on different machine/VS instance and then moving it over to the VS 2010 Express for Windows Phone 7 and changing a few things. Reason being the deployment and connecting to emulator would literally take 3-5 minutes, so I would hit Ctrl+F5 and sit there waiting (or more likely switch to something else and forget what I was about to do). Luckily after my app worked on regular Silverlight, there was very little I had to change.

Edit App.xaml to change default styles.

I had to change default font size for my app, and found that the default styles and brushes, such as PhoneForegroundBrush and PhoneBackgroundBrush are in App.xaml.

<system:Double x:Key="PhoneFontSizeNormal">26</system:Double>

The App

My app uses Purdy Points algorithm (that I borrowed from here) to predict race pace, based on past running performance.  BTW, If you are runner and/or would like to know more about Purdy Points, here's the website, it also has a proper calculator that provides more data.

On an emulator my app looked like this:

Purdy Points Calculator on Windows Phone 7 Emulator

TextBox.InputScope

For my time input text boxes I wanted the number keypad appear when they get focus.

 numeric keypad

Then I came across this forum topic. InputScope property determines the context for the input. Actually I also expected it to restrict the input to whatever context it is set, i.e. in my case I would have liked it to restrict input to numeric characters. However it is not part of InputScope functionality, so I had to implement filtering myself. At first I tried to set InputScope as part of style for my TextBox:

....

<Setter Property="InputScope" Value="Number"/>

....

but it would crash inside InitializeComponent() with a parsing exception missing any additional information. It works though when it is not part of style definition. Anyway, in my case I set it in code, because I subclassed the TextBox to implement custom focus and filtering behavior.

InputScope = new InputScope();
InputScope.Names.Add(new InputScopeName() { NameValue = InputScopeNameValue.Number});

Microsoft.Phone.Controls.ListView

Initially I used ListBox to display the results and then noticed that there's a new ListView control in Microsoft.Phone.Controls.dll. ListView inherits from ListBox (same as in WPF) so I in theory all I had to do was to change my tags in xaml from ListBox/ListBoxItem to ListView/ListViewItem. But when I attempted to bind the control to the collection, it failed to render leaving me with the following mysterious output.

ListView error

For now I switched it back to using ListBox, but I'll look into this later and will post update to this blog when I find the issue.

Zipped SLN, references and acknowledgments 

  1. Complete zipped solution: https://bit.ly/98DhVr 
  2. Windows Phone 7 Developer Tools CTP download page: https://www.microsoft.com/downloads/details.aspx?FamilyId=2338b5d1-79d8-46af-b828-380b0f854203&displaylang=en
  3. Purdy calculator algorithm: https://www.cs.uml.edu/~phoffman/xcinfo3.html