Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WP7-ListBox: Should I use Tap or SelectionChanged?

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?

like image 965
Sam Avatar asked Jan 17 '23 11:01

Sam


1 Answers

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.

like image 109
Mats Hofman Avatar answered Jan 28 '23 04:01

Mats Hofman