protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); //fillToday(); buildApplicationBar(); StateHelper stateHelper = new StateHelper(this.State); SelectedDate = stateHelper.GetValue("SelectedDate", SelectedDate); dayCtrl.Fill(SelectedDate); pivot.Title = SelectedDate.ToLongDateString(); if (ApplicationState.Current.CurrentBrowsingTrainingDays.TrainingDays.ContainsKey(SelectedDate)) { var info = ApplicationState.Current.CurrentBrowsingTrainingDays.TrainingDays[SelectedDate]; viewModel = new TrainingDayViewModel(info.TrainingDay); SelectedDayDTO = info.TrainingDay; viewModel.BlogCommentsLoaded += (s, a) => { progressBar.ShowProgress(false); updateApplicationBarButtons(); }; } else { viewModel = new TrainingDayViewModel(null); } viewModel.Restore(State); DataContext = viewModel; }