Skip to content

Instantly share code, notes, and snippets.

@clausjoergensen
Created August 13, 2011 18:47
Show Gist options
  • Save clausjoergensen/1144149 to your computer and use it in GitHub Desktop.
Save clausjoergensen/1144149 to your computer and use it in GitHub Desktop.
OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
SmartDispatcher.BeginInvoke(() =>
{
if (DataContext == null)
DataContext = new MainPageViewModel();
// ViewModel is the DataContext typecast'd to MainViewModel
if (ViewModel != null && ViewModel.IsInitialized == false)
ViewModel.Initialize();
if (ApplicationBar == null)
BuildApplicationBar();
});
base.OnNavigatedTo(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment