void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { // Check for no saved state (new page navigation) if (e.PageState == null) return; object value; if (e.PageState.TryGetValue("Value1TextBox", out value)) { Value1TextBox.Text = e.PageState["Value1TextBox"] as string; } if (e.PageState.TryGetValue("Value2TextBox", out value)) { Value2TextBox.Text = e.PageState["Value2TextBox"] as string; } if (e.PageState.TryGetValue("RadioButton1Value", out value)) { RadioButton1.IsChecked = (int)(e.PageState["RadioButton1Value"]) == 1 ? true : false; } else RadioButton1.IsChecked = null; if (e.PageState.TryGetValue("RadioButton2Value", out value)) { RadioButton2.IsChecked = (int)(e.PageState["RadioButton2Value"]) == 1 ? true : false; } else RadioButton2.IsChecked = null; if (e.PageState.TryGetValue("RadioButton3Value", out value)) { RadioButton3.IsChecked = (int)(e.PageState["RadioButton3Value"]) == 1 ? true : false; } else RadioButton3.IsChecked = null; }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { }