private void FinishButtonOnClick(object sender, RoutedEventArgs e) { vitals.MomsMaidenName = this.txtboxMom.Text; vitals.Pet = Vitals.GetCheckedRadioButton(this.grpboxPet).Content as string; vitals.Income = Vitals.GetCheckedRadioButton(this.grpboxIncome).Content as string; WizardPage4 page = new WizardPage4(vitals); //这里没有使用GoForward方法,是为了调用一次WizardPage4里的构造函数。 NavigationService.Navigate(page); }
public WizardPage4(Vitals vitals) { InitializeComponent(); this.runName.Text = vitals.Name; this.runHome.Text = vitals.Home; this.runGender.Text = vitals.Gender; this.runOS.Text = vitals.FavoriteOS; this.runDirectory.Text = vitals.Directory; this.runMomsMaidenName.Text = vitals.MomsMaidenName; this.runPet.Text = vitals.Pet; this.runIncome.Text = vitals.Income; }
private void NextButtonOnClick(object sender, RoutedEventArgs e) { vitals.Name = this.txtboxName.Text; vitals.Home = Vitals.GetCheckedRadioButton(this.grpboxHome).Content as string; vitals.Gender = Vitals.GetCheckedRadioButton(this.grpboxGender).Content as string; if (NavigationService.CanGoForward) { NavigationService.GoForward(); } else { WizardPage2 page = new WizardPage2(vitals); NavigationService.Navigate(page); } }
private void BeginButtonOnClick(object sender, RoutedEventArgs e) { //NavigationService获得的是主窗口中的Frame中Navigation //使用GoBack与GoFoward的优点是,页面已经被建立、加载,而且或许被用户修改过,使用这些方法导航会保留用户输入的数据 if (NavigationService.CanGoForward) { NavigationService.GoForward(); } else { Vitals vitals = new Vitals(); WizardPage1 page = new WizardPage1(vitals); NavigationService.Navigate(page); } }
public WizardPage1(Vitals vitals) { InitializeComponent(); this.vitals = vitals; }