c# - Reloading MainPage in WP7 to restart the app -
my app has 1 page - mainpage. when user selects "new" applicationbar menu want clear source data , reload page.
can navigationservice? following line gets navigation failed exception in rootframe of app when called within mainpage itself:
this.navigationservice.navigate(new uri("mainpage.xaml", urikind.relative));
can done easily, or need create second page navigate before navigating mainpage?
using navigation purpose sounds horrible way of doing it! if create second page workaround problem facing, remain on back-stack, meaning reachable when user hits button.
i recommend adopting mvvm pattern (see example here). when new button pressed, create new view model , associate mainpage
setting datacontext
, have affect desire of clearing , resetting state.
Comments
Post a Comment