I'm creating an WP7-app with a PhoneApplicationPage containing a ListBox.
When the user selects an item in the ListBox another page will be opened.
Now I'm confused a bit: Which ListBox event handler should I use to detect the selection, Tap or SelectionChanged? And how do I get the tapped item in case of Tap?
I would suggest you use the SelectionChanged
event, this will always register in the correct way if an item is clicked.
A benefit of using the SelectionChanged
event is that you will get SelectionChangedEventArgs which contains useful information.
A important thing to do however is to reset the selected index back to -1 when an item has been clicked, otherwise when the user comes back to the page that item is still selected and the item won't be clickable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With