I saw here and in some articles that I should use GestureListener to get Tap from user then use SelectionChanged. I tried it and I like it. But I have problem with it. When my listbox moves (scrolls) and I try tap I get bad item (I get item from last tap). When I scroll and wait for stopping scroll and then tap everything is fine (I get exactly item which I tap on). Anyone else with this problem? Any solution? Thanks
As (according to your tags) you're targetting 7.1, there is no need to have to use a GestureListener
to detect Tap
events.
All UIElements in Silverlight 4 (which 7.1 is based on) support a built in Tap
event. See http://msdn.microsoft.com/en-us/library/system.windows.uielement.tap(v=vs.95).aspx
Using a GestureListener
has an unnecessary performance overhead and can cause other issues as you're discovering.
You should use a Tap
event in the individual ListBoxItem
s or the SelectionChanged
event on the ListBox
not both.
If you create a new Databound Application, the code in the default project files will show an example of how to use SelectionChanged
and in that instance trigger a page navigation.
In future, you may also get a better, faster answer by showing the code you are having problems with, not just describing it.