Quantcast
Channel: Silverlight Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 801

Closed Issue: WP7: ArgumentOutOfRangeException in ListPicker while resuming from tombstone [8487]

$
0
0
(The entire stack trace is here if you need it: http://forums.create.msdn.com/forums/p/77312/469399.aspx)

Case: The ListPicker's ItemSource is set via XAML binding but the SelectedItem is set in code via OnNavigatedTo.

Positive Test Case: Forward or backward Navigate to XAML page. Result: ListPicker value correctly set.

Negative Test Case: Press "Window" button while displaying XAML page. Press "Back" button to resume. Result: Multiple unhandled errors.

Source: ListPicker.OnItemsChanged :

// Re-synchronize SelectedIndex with SelectedItem if necessary
if (!object.Equals(Items[SelectedIndex], SelectedItem))

SelectedIndex is -1 on the line above, causing the noted exception while fetching the item at position -1 from the Items collection.

Recommended remedy: A check in OnItemsChanged for SelectedIndex==-1 and then "Re-synchronize SelectedIndex" without first attempting to read the Items collection.

Work around: Wait until ListPicker.Items.Count>0 in OnNavigatedTo before setting SelectedItem.
Comments:

I was unable to reproduce this, if you can please provide a simple repro and re-open the bug with it attached then we'll gladly investigate.


Viewing all articles
Browse latest Browse all 801

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>