wpf - Do XAML objects remain virtually present when leaving a XAML page in Windows 8 App? -


i use mvvm light toolkit define association between view-model , view.

the container instructed register view-model singleton instance. thus, same instance returned when gagaviewmodel required:

public gagaviewmodel gagaviewmodel {         {         var vm = servicelocator.current.getinstance<gagaviewmodel>();         vm.setup(); //clear observablecollection         return vm;     } } 

you can click on thumbnail item on priorgaga.xml. self-chosen item selected in gridview "mygridview" in gaga.xaml. code-behind file of gaga.xaml:

protected override async void loadstate(object navigationparameter, dictionary<string, object> pagestate) {     var itemid = navigationparameter string;     if (string.isnullorempty(itemid))     {         throw new argumentexception("navigationparameter either null or empty");     }      await ((gagaviewmodel)datacontext).init(itemid); //busy(-indicator) while loading data server, filling observablecollection , writing selected item down      bringitemintoview(); }  private void bringitemintoview() {     var vm = (gagaviewmodel)datacontext;      dispatcher.runasync(coredispatcherpriority.normal,                         () => mygridview.scrollintoview(vm.selecteditem)); } 

that works fine. sample: item #45 appears within viewport (correct viewport position beginning).

but when click button , return gaga.xaml selecting arbitrarily thumbnail item (let's #29), see item #1 , switch #29 (the viewport moving on container). know what's going on under there? there virtualized items in container preceding gaga.xaml visit?

my understanding lifespan of instance of gaga page determined navigationcachemode property. default, set disabled. assuming haven't changed property, should seeing new instance of gaga page every time navigate it. can verify behavior setting breakpoint in constructor. consequently, think each time navigate gaga, behavior of ui should identical, because fresh.

(i wanted add comment, since haven't answered question, sadly not have enough rep. apologize in advance; please not smite me down!)


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -