What I Learned In WP7 – Issue 16

Yesterday, I had a developer reach out to me about a seemingly simple problem, but it wasn’t until I looked at it in a greenfield project that I could solve it quickly.  In the XAML below, I have a ListBox that I bind a List of objects to.  What the developer was trying to do was get the text in the “AlternateText” TextBox for the item clicked.

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
	<ListBox x:Name="masterList" SelectionChanged="masterList_SelectionChanged">
				<StackPanel Orientation="Horizontal">
					<Image x:Name="ActionImage" Source="{Binding ActionImage}" Width="100" Height="100"/>
						<TextBlock x:Name="ActionText" Text="{Binding ActionText}" FontSize="40" Width="300" />
						<TextBlock x:Name="AlternateText" Text="{Binding ActionDescription}" />

The important thing to remember here is that when you call the SelectionChanged event on a ListBox, the ListBox still recognizes each item as its original object.  Therefore, you should actually be trying to access the specific object that was selected, and then access the properties of that object, instead of the XAML elements that make up the ListBox’s layout.

Here’s the solution we implemented, where TestClass is the object type we’re using:

private void masterList_SelectionChanged(object sender, SelectionChangedEventArgs e)
	ListBox testList = sender as ListBox;
	TestClass testText = (TestClass)testList.SelectedItem;
	string whatImLookingFor = testText.AlternateText;

What I Learned In WP7 – Issue 15

I learned something about pricing your applications in the Windows Phone Marketplace  today that I never expected.  (Keep in mind this entire article is based on my sample size of ONE, but it’s an interesting thought exercise.)

Trial Mode might actually HURT your sales.

Let me explain:  I have been very diligent with my applications in the marketplace to make sure that they offer a compelling Trial mode to my users.  I want them to download it, and try it, so that they will ultimately buy it.  None of my applications are crazy addictive, or something that I thought would sell millions of copies.  Not by a long shot.  But I did think that I would sell SOME.

In fact, I am selling some.  Maybe 5 copies a day across all three of my paid applications (5 total, not 15).  Probably right in line with what I expected for the time/effort I put into some of these applications.  But I tried an experiment recently, and it had interesting results.

I am speaking at the CodeMash conference this week, and in one of my sessions, I am building a simple Twitter app alongside an iPhone developer and an Android developer.  We each get 15 minutes to build the same application.  (In other words, it’s incredibly simple.)

I decided it would be cool to have the application I was building for the session be available for download after the session, so I submitted it to the Marketplace over the holidays.  I had no trouble getting it submitted, but I decided to price it at 99 cents, with no trial mode (conversely, the rest of my applications offer limited functionality in Trial mode.)

Twitter Stalker (the app I’m talking about) sold 5 copies on New Year’s Day.  And has continued to sell at a higher rate than my other applications.  It’s description even says that “This is an application that was built as a demonstration at the CodeMash conference in Sandusky, OH on January 13, 2011.”


Now, I know that there are numerous factors that go into something like this, and one anomaly does not mean correlation.  For example, people might just be looking for a new Twitter client, and willing to spend the 99 cents to find out if it’s good.  On the other hand, if I had offered a trial mode, then they certainly would NOT have spent the 99 cents afterwards.  The app is really nothing special.

So, here’s your food for thought:

When building a simple application, is it more important for your users to LOVE your application?  Or is it more important to you that they BUY it?

I propose that if you’re building something simple, that can easily be explained in your description, perhaps a Trial mode isn’t something you should offer.  Perhaps people would be willing to pay 99 cents to find out if your application is what they’re looking for.  By offering a trial, you’re actually giving them the chance to NOT like it.

What do you think?

What I Learned In WP7 – Issue 14

I’ve been working on some dynamic Panorama designs, but there were a couple of things I was finding tricky:

1) Loading a Panorama control at a specific position. (also just navigating to a different place in one.)

2) Preventing a Panorama from wrapping around from the last to the first element.

In the first case, I just wasn’t looking in the right place.  To change which panel of a Panorama you are viewing, you can use:

Panorama.DefaultItem = Panorama.Items[index];

For the second case, you might be asking WHY I would want to prevent the Panorama from wrapping around, which is the default behavior.  In my application, when you first come to the Panorama control, you only have ONE PanoramaItem.  So scrolling is more confusing than anything else.  As you continue to enter data into the app, however, the Panorama can grow to as many as 10 Panorama items.

The short story on this, however, is that it’s not really possible.  If you need to change the Panorama’s behavior that drastically, you might want to look at using a different control.

What I Learned In WP7 – Issue 13

I had intended to do a whole year-end wrap-up, but just never got around to it.  Expect something like that in January sometime.  In the meantime, the folks over at Technobolt put together a neat little infographic about all of the Windows Phones that are currently (or anticipated to be) available.

Have a great New Year, and let’s kick 2011 off strong.  What are you planning to build in 2011?

What I Learned In WP7 – Issue 12

Someone asked a question on StackOverflow today about the RGB colors for each of the default colors on Windows Phone.  I’ve answered it there, but I’m also publishing it here (along with the Hex values), so you have it for reference.

Color Name Hex Value RGB Value (R,G,B) Visual
Magenta #FF0097 255,0,151  
Purple #A200FF 162,0,255  
Teal #00ABA9 0,171,169  
Lime #8CBF26 140,191,38  
Brown #A05000 160,80,0  
Pink #E671B8 230,113,184  
Orange #F09609 240,150,9  
Blue #1BA1E2 27,161,226  
Red #E51400 229,20,0  
Green #339933 51,153,51  


What I Learned In WP7 – Issue 11

I am currently learning a ton about MVVM and testing on Windows Phone.  If you are just starting to build an application, I highly recommend checking out Jeff Wilcox’s post about his Silverlight Unit Test Framework. (jeffwilcox.com)

You’ve certainly used a ListBox control before, but you’ve likely been pining for a ListBox that allows drag-and-drop re-ordering.  Jason Ginchereau has created one, and made it available.  Check it out on his blog. )(Jason Ginchereau’s blog)

What I Learned in WP7 – Issue 10

First, I hope everyone has a great holiday.  I’m going to be disappearing for a  few days, but I’ll likely be back by Tuesday, December 28.  I recommend that you do the same.  Step away from the computer, and find some people to spend time with.  Family, friends, colleagues (sometimes they’re not your friends, right?), neighbors, etc.  Spend some time with the people you care about.  It’s important.

Yesterday, I mentioned how you can pass data using a query string in Windows Phone development.  @PhraseMeme (on Twitter) was kind enough to remind me that you should probably consider escaping your data before passing it as a query string, just as you would in a website.  To do this, you can use the Uri.EscapeDataString method to convert all of your non-reserved characters to their hexadecimal equivalents.  Obviously, when you receive that data, you’ll also want to use the UnescapeDataString method to convert it back.