I'm updating an app for a client at the moment and for one of the visual tweaks that I wanted to add meant I wanted to replace a ListBox with a LongListSelector.
All should be simple enough. It should just be a case of replacing this:
<ListBox ItemsSource="{Binding Sessions}"> <ListBox.ItemTemplate> <DataTemplate> // ... </DataTemplate> </ListBox.ItemTemplate> </ListBox>
with this:
<phone:LongListSelector ItemsSource="{Binding Sessions}"> <phone:LongListSelector.ItemTemplate> <DataTemplate> // ... </DataTemplate> </phone:LongListSelector.ItemTemplate> </phone:LongListSelector>
All seemed good but then no items were shown on the page.
Huh!?
Why?!
Well, it turns out that in the ViewModel the Sessions property was an IEnumerable<Session>.
For the LongListSelector to be able to load the items it needs the NotifyPropertyChanged events to be raised. The easiest way to do this was to change the Sessions property to be an ObservableCollection<Session>. This way the necessary events are raised and content is displayed. :)
Obvious really.
Hopefully this reminder will save someone else some head scratching in future.
A collection of items will appear in the LLS w/o the collection being an ObservableCollection. Take the DataBoundApp sample. If you change the Items property of the MainViewModel to a List, or Collection items will still show provided that you notify the UI that the collection has changed. For the sample app it can be as simple as calling NotifyPropertyChanged("Items"); in the end of the LoadData method. If your collection already has data then the LLS will show without any problems.
ReplyDeleteThanks for the extra info Shawn. I just wanted to highlight the fact that ListBox and LongListSelector behave differently in this area.
DeleteWhat a great UK blog! Found lots of fabulous info! Big thanks to admin.
ReplyDeleteIn line Coach Outlet Online is bringing Michael Kors Outlet unique Coach Factory Outlet to a Toms Shoes USA shoe for Cheap Jerseys Spring/Michael Kors Outlet 2014 Coach Factory Outlet, and this Coach Outlet, it's a Coach Outlet. The Coach Outlet Sale Sandal Giuseppe Zanotti Outlet.Supermodel mom Coach Factory Outlet was Coach Factory Outlet Online being all kinds of hot this weekend Coach Factory Outlet she Coach Store Online out in a Michael Kors Outlet-turning, Celine Outlet I did, I was Celine Bags possessed by Fitflops Flipflops suit madness.Fitflops USA-there string Michael Kors during Michael Kors Store vacation in Tomss Hoes Bahamas. Fitflop Footwear by her family, the 40-year-old looked happy and relaxed - Fitflops Outlet, uh, did we Fitflops Sandals super hot? - as she Giuseppe Zanotti by the pool.I've Giuseppe Zanotti Designer making my own vanilla extract for years. I love it! It's cost-effective, and in my opinion, Vanilla extract is also (easily) the most used extract in my Prada Outlet , sort of pretty (although it kind of looks like spiders too) tastes way better than imitation vanilla extract.
ReplyDeleteadidas shoes
ReplyDeleteralph lauren uk
mizuno running
christian louboutin outlet
toms outlet
kate spade outlet
cheap football shirts
puma outlet store
ray ban sunglasses
cheap ray ban sunglasses
tory burch handbags
fivefingers shoes
north face jackets
chicago blackhawks jersey
snapback hats wholesale
tiffany jewelry
futbol baratas
gucci shoes
nike free
coach factory outlet
marc jacobs
mulberry outlet
hermes birkin
cartier bracelet
north face outlet
foamposite shoes
nba jerseys
longchamp sale
burberry outlet
swarovski uk
gucci shoes
oakley sunglasses
polo ralph lauren outlet
ralph lauren outlet online
pittsburgh steelers jersey
adidas wings
hollister
chanel handbags
chanel outlet
polo lacoste pas cher
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
ninest123 11.24
ReplyDeletelouboutin uk, nike outlet, louis vuitton handbags, michael kors outlet online, nike air max, ralph lauren polo, longchamp bags, replica watches, christian louboutin, uggs outlet, burberry factory outlet, tiffany jewelry, uggs on sale, louis vuitton outlet, michael kors handbags, burberry outlet, tory burch outlet, ray ban sunglasses, oakley sunglasses, louis vuitton outlet, longchamp outlet, oakley sunglasses, ray ban sunglasses, ray ban sunglasses, oakley sunglasses, gucci handbags, oakley sunglasses, cheap jordans, ralph lauren outlet, tiffany jewelry, louis vuitton, uggs outlet, replica watches, michael kors outlet, prada handbags, michael kors, prada outlet, uggs on sale, christian louboutin, nike air max, louis vuitton outlet online, louboutin shoes, uggs on sale, nike free, michael kors outlet online, michael kors outlet store, longchamp outlet, cheap oakley sunglasses
north face pas cher, ray ban uk, polo lacoste pas cher, nike air max, nike air max uk, vanessa bruno pas cher, nike roshe uk, nike roshe run pas cher, abercrombie and fitch UK, nike air force, michael kors, michael kors outlet online, polo ralph lauren uk, true religion outlet, lululemon outlet, new balance, timberland pas cher, louboutin pas cher, michael kors uk, nike tn pas cher, hogan sito ufficiale, hermes pas cher, nike blazer pas cher, nike free pas cher, vans pas cher, nike air max pas cher, ralph lauren pas cher, nike air max uk, abercrombie and fitch, lunette oakley pas cher, true religion outlet, true religion jeans, coach outlet, burberry pas cher, sac guess pas cher, converse, north face uk, nike trainers uk, nike free, true religion outlet, hollister uk, mulberry uk, coach outlet store online, coach purses, michael kors, lunette ray ban pas cher, longchamp pas cher, longchamp soldes, jordan pas cher
ReplyDeletesupra shoes, coach outlet, bottes ugg pas cher, moncler, converse shoes outlet, canada goose pas cher, canada goose uk, juicy couture outlet, juicy couture outlet, moncler pas cher, sac louis vuitton, links of london uk, swarovski jewelry, sac louis vuitton, ugg,uggs,uggs canada, toms shoes, canada goose jackets, karen millen uk, montre pas cher, lancel, canada goose, moncler, uggs outlet, michael kors outlet, moncler uk, ugg uk, barbour, thomas sabo uk, wedding dresses uk, ugg,ugg australia,ugg italia, canada goose outlet, doke & gabbana, barbour jackets uk, replica watches, ugg pas cher, louis vuitton uk, moncler outlet, pandora charms, swarovski uk, marc jacobs, louis vuitton, canada goose outlet, pandora jewelry, louis vuitton, canada goose jackets, moncler, pandora uk, moncler jackets, moncler, hollister, pandora jewelry, canada goose
ReplyDeleteabercrombie and fitch, nike roshe run, soccer shoes, oakley, wedding dresses, polo ralph lauren, nike air max, nike air max, vans scarpe, valentino shoes, vans outlet, herve leger, p90x workout, beats by dre, iphone 5s cases, soccer jerseys, hollister, ray ban, instyler ionic styler, iphone cases, bottega veneta, insanity workout, s6 cases, timberland boots, giuseppe zanotti, jimmy choo outlet, iphone 6s plus cases, iphone 6 cases, mcm handbags, converse, reebok outlet, babyliss pro, louboutin, lululemon outlet, chi flat iron, mont blanc, new balance shoes, iphone 6 plus cases, north face outlet, salvatore ferragamo, mac cosmetics, asics running shoes, ghd hair, north face outlet, hollister clothing, softball bats, nfl jerseys, hermes handbags, ipad cases, celine handbags, gucci, iphone 6s cases
ReplyDeleteninest123 11.24
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