windows phone 7 - Panorama Control not showing data -
i making panorama windows phone 8 app. first time have used 1 in app.
i having problems showing data in runtime. instead seeing list:
runtimeone runtimetwo runtimethree etc..
i don't have clue has happened, worked other day. going sampledata folder , changing lineone, linetwo, linethree, etc it's not doing when deploy app windows phone emulator.
what's happening there 2 different sets of data, , datacontext
@ runtime different design time.
the data see in design mode ('design one', 'design two') stored in
mainviewmodelsampledata.cs
, changing doesn't affect runtime experience.the data @ runtime coming
loaddata
method inmainviewmodel.cs
at top of mainpage.xaml
, you'll see
d:datacontext="{d:designdata sampledata/mainviewmodelsampledata.xaml}"
and "d" namespace here mnemonic 'design'. if @ sample data xaml file, you'll notice declares class called mainviewmodel
collection of items
.
at runtime, mainviewmodel.cs
(specifically loaddata
method) adds items 1 one items
property of mainviewmodel
class, , class in turn set runtime datacontext
in constructor of mainpage
the panorama control has markup like
<phone:longlistselector margin="0,0,-22,0" itemssource="{binding items}">
so it's expecting see collection called items
on whatever current datacontext is, , fact 2 different data contexts in play explains you're seeing.
the data binding magic incredibly cool , powerful, leave scratching head.
Comments
Post a Comment