But don't attach an event handler to the `OnSelectionChanged` (or equivalent `OnSelectedItemChanged`) events and then use this as the trigger for starting navigation.
This is typically used when there are options displayed in a list[box] and the user can select an item to navigate to the appropriate page. It's also really common for such a list to be large enough that the user must scroll to see all the items. Therein lies the problem. It's common for the first part of the swipe gesture (intended to scroll the list) to be interpreted as a selection. This then causes the app to navigate to the item that was touched while swiping, not the one the user actually wanted.
Instead, add a handler for the `Tap` event of the individual item. This way you don't risk confusing the gestures.
This way you'll have an app that behaves as the user expects. This is definitely a step towards having happier users which will hopefully help lead to you havinng more of them.
Demo needed to persuade me (I'll do one myself in my "spare time"!)
ReplyDelete@Slodge mr.lacey speaks the truth. If you want another reason imagine that you trigger your nav based on the ListBox selected item changing.
ReplyDelete1. User selects item 2 and you nav to child page X and display item 2. Nice
2. User presses Back and they come back to the same listbox
3. User thinks "oooops I need to look at item 2 some more"
4. Press item 2
5. Nothing happens, no nav, user starts to cry.
Why? because the selection was set to item 2 in step 1 and never changes it is still item 2 as step 4 happens. Selection does not chnage and your nav never fires.
@MunkiiYebee - Yes, this solves that problem too. :)
ReplyDeleteSelecting something in a list is not the same as wanting to navigate to the place represented by that item in the list. The difference is subtle, but important.
You should select something if you want to subsequently perform an action with teh selected item or change something else on the same page in relation to the selection. (Such as display details in a master-detail relationship. - But that's typically hard to do on a small screen.)
@MunkiiYebee - I always just work around that problem by resetting the SelectedIndex before I navigate. I've got to admit the reason I use SelectedIndex is because one of the appwizard basic templates did when I first started... but beyond that I still would need to actually see a demo where there was a difference...
ReplyDeleteRun the appwizard for Pivot.
ReplyDeleteChange pivot 1 to use:
SelectionChanged="FirstListBox_SelectionChanged"
Change pivot 2 datatemplaet to use:
Change the code behind to:
private void FirstListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (((ListBox)sender).SelectedIndex == -1)
return;
MessageBox.Show("Selection");
((ListBox)sender).SelectedIndex = -1;
}
private void StackPanel_Tap(object sender, GestureEventArgs e)
{
MessageBox.Show("Tap");
}
I honestly can't see any difference running on the phone... can you? (What gesture am I missing?)
Please note that `ListBoxItem` has a `Tap` event. Do not use the `GestureListener` to detect a tap. In fact, don't use the GestureListener at all. It has potentially nasty issues including performance implications.
ReplyDeleteThank you please.
new orleans saints jerseys
ReplyDeleteferragamo shoes
true religion outlet
ghd hair straighteners
cartier watches
kate spade
air jordan 11
kate spade sale
cheap nike shoes
dallas cowboys jersey
prada handbags
true religion jeans
babyliss hair dryer
ray ban aviator
cheap nfl jerseys
louis vuitton outlet
true religion
karen millen sale
michael kors canada
louis vuitton outlet online
tiffany and co
michael kors uk
gucci outlet
the north face outlet store
karen millen dresses
chelsea jersey
iphone 6 cases
mont blanc pens
jordan 4 retro
michael kors outlet online sale
hermes outlet
kobe shoes
abercrombie outlet
swarovski jewelry
louis vuitton outlet
tory burch outlet online
tods shoes
nike free uk
instyler ionic styler pro
moncler coats
0722maoqiuyun
san antonio spurs, http://www.sanantoniospursjersey.com/
ReplyDeletesalomon running shoes, http://www.salomonshoes.us.com/
golden state warriors, http://www.warriorsjersey.com/
ralph lauren,ralph lauren uk,ralph lauren outlet,ralph lauren outlet online,polo ralph lauren outlet,ralph lauren polo
minnesota vikings, http://www.minnesotavikingsjersey.us/
hermes bags, http://www.hermesbags.co.uk/
adidas outlet store, http://www.adidasoutletstore.us.com/
canada goose coats, http://www.uggbootscheap.eu.com/
michael kors outlet store, http://michaelkors.outletonlinestores.us.com/
nike air max,air max,air max 2014,nike air max 2014,air max 90,airmax,air max 95,air max 2013,nike air max 90,nike air max 2013
cheap mlb jerseys, http://www.cheapmlbjerseys.us.com/
cyber monday, http://www.blackfriday2015.in.net/
michael kors outlet,michael kors outlet online,michael kors,kors outlet,michael kors handbags,michael kors outlet online sale,michael kors handbags clearance,michael kors purses,michaelkors.com,michael kors bags,michael kors shoes,michaelkors,cheap michael kors
moncler jackets, http://www.uggoutletstore.eu.com/
soccer jerseys,soccer jerseys wholesale,soccer jerseys cheap,soccer jerseys for sale,cheap soccer jersey,usa soccer jersey,football jerseys
canada goose outlet, http://www.canada-goosejackets.us.com/
air jordan 4 retro, http://www.airjordan4.org/
ugg uk outlet, http://www.snowboots.us.com/
air jordan 11 retro, http://www.airjordan11.net/
kkkk1012
jianbin1208
ReplyDeletemichael kors uk outlet
fred perry shirts
lebron james shoes,lebron 12,lebron 12 shoes,lebron sneakers,lebron iv,lebron 11,lebron 10
nike air max 2014
timberland outlet
adidas jeremy scott
adidas outlet store
canada goose jackets
nike air huarache,nike huarache,nike huarache sneakers,nike huarache shoes
uggs outlet
north face jackets
football shirts uk,soccer jerseys uk,cheap soccer jerseys uk
coach outlet
winter coats outlet
ray ban sale
chanel handbags
michael kors usa
louis vuitton outlet online
lebron 12
michael kors outlet online
uggs outlet
ray ban sunglasses outlet,ray ban sunglasses,ray ban,rayban,ray bans,ray ban outlet,ray-ban,raybans,ray ban wayfarer,ray-ban sunglasses,raybans.com,rayban sunglasses,cheap ray ban
canada goose jackets
cheap mlb jerseys
uggs outlet
cheap ugg boots
winter jackets outlet
los angeles clippers
dallas cowboys