Programmatically close ListPicker from WP7 Silverlight Toolkit
-
10-10-2019 - |
Question
My app is being rejected from the Marketplace because of requirement 5.2.4.c (back button must close menu or dialog and cancel back navigation). I'm using a ListPicker from the Silverlight Toolkit and that's what's causing the failure: pressing the back button when the ListPicker is open goes back instead of closing the ListPicker and cancelling back navigation.
This seems simple enough to fix: if the user presses the back button and the ListPicker is open, I close it and cancel back navigation. However, I haven't seen a way of programatically either detecting whether a ListPicker is open, or closing a ListPicker.
Am I missing something? How could I fix this bug?
Solution
One again, I have asked the question too soon. The answer is here: http://silverlight.codeplex.com/workitem/7643
OTHER TIPS
The solution is
protected override void OnBackKeyPress(CancelEventArgs e)
{
base.OnBackKeyPress(e);
if (yourListPicker.ListPickerMode == ListPickerMode.Expanded)
{
yourListPicker.ListPickerMode = ListPickerMode.Normal;
e.Cancel = true;
}
}