/// <summary> /// CreateWizardPages instantiates all of the Wizard Pages /// and hooks them up to the respective ViewModels. /// </summary> private void CreateWizardPages() { //Create a List to hold the Pages List <WizardPage> pages = new List <WizardPage>(); //Create the Welcome Page PageWelcomeViewModel welcomeVM = this._unity.Resolve <PageWelcomeViewModel>(); PageWelcomeView welcomeV = this._unity.Resolve <PageWelcomeView>(); welcomeVM.Config = this._config; welcomeV.DataContext = welcomeVM; pages.Add(welcomeV); //Create the Installed Hardware Page PageInstalledHardwareViewModel installedVM = this._unity.Resolve <PageInstalledHardwareViewModel>(); PageInstalledHardwareView installedV = this._unity.Resolve <PageInstalledHardwareView>(); installedVM.Config = this._config; installedVM.HookEvents(installedV); installedV.DataContext = installedVM; pages.Add(installedV); //Create the License Page PageLicenseViewModel licenseVM = this._unity.Resolve <PageLicenseViewModel>(); PageLicenseView licenseV = this._unity.Resolve <PageLicenseView>(); licenseVM.Config = this._config; licenseV.DataContext = licenseVM; pages.Add(licenseV); //Create the Finish Page PageFinishViewModel finishVM = this._unity.Resolve <PageFinishViewModel>(); PageFinishView finishV = this._unity.Resolve <PageFinishView>(); finishVM.Config = this._config; finishVM.HookEvents(finishV); finishV.DataContext = finishVM; pages.Add(finishV); //Set the ItemsSource this.ItemsSource = pages; }
/// <summary> /// HookEvents hooks the events on the View to the /// Methods on the ViewModel. /// </summary> /// <param name="view">The View to hook events</param> public void HookEvents(PageFinishView view) { //Hook the events view.Selected += new System.Windows.RoutedEventHandler(view_Selected); }