Mike Ormond's Blog

Musings on mobile development and Windows Phone 7 in particular.

Failing Marketplace Submission - A Dose of my own Medicine

Failing Marketplace Submission - A Dose of my own Medicine

  • Comments 1

I’d been helping someone out with a Windows Phone 7 application. Like many other apps, the app retrieved data from a webservice. If there was an issue retrieving data, a message would be displayed to the user which, in XAML looked like a bit like this:

<Border x:Name="NoDataMessage" 
  Grid.RowSpan="2"
  Background="Black" 
  IsHitTestVisible="False" 
  Opacity="0.75" 
  Visibility="Visible">
  <Border VerticalAlignment="Center">
    <StackPanel>
      <TextBlock TextAlignment="Center"
        TextWrapping="Wrap"
        Text="Service unavailable. Please check your network." 
        Style="{StaticResource PhoneTextLargeStyle}" />
    </StackPanel>
  </Border>
</Border>

Or a bit like this if your XAML visualisation capabilities are a bit rusty:

image

Simple but effective. You simply toggle the message visibility (or databind it) depending on the results of the web request.

There’s a classic problem here though – and one that caused the app to fail certification. Section 5.5 of the Application Certification Requirements document states

2011-05-03 10h44_29

I even talk about this when I present on tips & tricks for passing Marketplace certification as it’s a very common failure. If I switch the device to the light theme, this is what the message looks like

image

Not so clever. The Textblock inherits the PhoneForegroundBrush colour which inverts to black when the user selects the light theme. Unfortunately that means we’re now presenting black text on a black background (with a 75% opacity applied, making it appear grey). It’s invisible and causes the app to fail a basic certification requirement.

A simple fix is to set the Foreground property of the Textblock to White (as the Background is always black this works). You could do something more sophisticated using PhoneBackgroundBrush / PhoneContrastBackgroundBrush / PhoneForegroundBrush / PhoneContrastForegroundBrush I’m sure.

The moral of the story is – check all of your pages, under all conditions, under both light and dark themes. Otherwise don’t be surprised when someone on the Marketplace testing team does.

FYI - A full list of theme resources is available on MSDN.

  • I did exactly the same thing last week. Spent ages testing it in Dark theme but forgot to check Light theme. Wasted 3 days on such a simple check. Although, I will never forget to check again.

Page 1 of 1 (1 items)