次の方法で共有


WP7 Silverlight Gotcha: Using the ListPicker from the Toolkit may cause you to fail certification

Applies To: Anyone using the current iteration of the Silverlight Tookit from Nov 2010

Toolkit Link:  https://silverlight.codeplex.com/releases

Quick Bits

A Toolkit ListPicker control that has less than 5 items in it will display inline (expands) but will not collapse when you press the back button (like the native control does). This can cause you to fail certification due to an erroneous interpretation of the certification guide.

The Fine Print

According to section 5.2.4c the following applies to the use of the Back Button:

If the current page displays a context menu or a dialog, the pressing of the Back button must close the menu or dialog and cancel the backward navigation to the previous page. 

The Setup

You have a ListPicker with less than 5 items in it, using the standard Silverlight Toolkit library.

The Sting

The Toolkit ListPicker doesn't listen for the back button when the ListPicker is in mini mode (i.e. it doesn't pop up the full screen list picker), so when you press back normal navigation occurs.

The Solution

There will be an update to the Toolkit coming out sometime this month that will address the issue, but if you want a fix now you basically need to either fix the Toolkit or listen in on the navigation event (and then check if a ListPicker is expanded and if so collapse it). I prefer the first option, since it's easy and you don't need to write redundant code if you have heaps of ListPickers.

To this end, you can download a patched ListPicker.cs file (replace this within your Toolkit Source project), or a built Toolkit DLL (unzip and replace your Toolkit installation under C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Toolkit\Nov10\Bin), with one change - the ListPicker will now respect the back button.

Does It Really Matter for Certification?

Actually, no. My reading of the certification guide doesn't indicate in any way that this is the expected behaviour, not to mention that I (and a bunch of other people) have other apps that were approved with the same control!

So, I fought the good fight, and lodged a support request (complaint) and got the following response:

Dear Oren,

I am sorry for the inconveniences you experienced!  It seems that there was a little misunderstanding during certification testing.  Dropdown list or list control does not need to be collapsed at Back button press and instead its previous screen can come up or if the back button was pressed from the application's first page, it can exit the application.   Please add a short tester note while submitting it explaining that the list control is not dialog and does not need to be closed.

We will also instruct our test team to correctly apply different expectations for list controls.

Thanks,

Windows Phone Marketplace Certification

I was impressed (I don't think they even knew I was from within Microsoft)!