public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { if (viewModelState == null) { return; } // Try to populate address and payment method controls with default data if available ShippingAddressViewModel.SetLoadDefault(true); BillingAddressViewModel.SetLoadDefault(true); PaymentMethodViewModel.SetLoadDefault(true); // This ViewModel is an example of composition. The CheckoutHubPageViewModel manages // three child view models (Shipping Address, Billing Address, and Payment Method). // Since the FrameNavigationService calls this OnNavigatedTo method, passing in // a viewModelState dictionary, it is the responsibility of the parent view model // to manage separate dictionaries for each of its children. If the parent view model // were to pass its viewModelState dictionary to each of its children, it would be very // easy for one child view model to write over a sibling view model's state. if (e.NavigationMode == NavigationMode.New) { viewModelState["ShippingViewModel"] = new Dictionary <string, object>(); viewModelState["BillingViewModel"] = new Dictionary <string, object>(); viewModelState["PaymentMethodViewModel"] = new Dictionary <string, object>(); } ShippingAddressViewModel.OnNavigatedTo(e, viewModelState["ShippingViewModel"] as Dictionary <string, object>); BillingAddressViewModel.OnNavigatedTo(e, viewModelState["BillingViewModel"] as Dictionary <string, object>); PaymentMethodViewModel.OnNavigatedTo(e, viewModelState["PaymentMethodViewModel"] as Dictionary <string, object>); base.OnNavigatedTo(e, viewModelState); }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { if (await _accountService.VerifyUserAuthenticationAsync() == null) { return; } var addressId = e.Parameter as string; HeaderLabel = string.IsNullOrWhiteSpace(addressId) ? _resourceLoader.GetString("AddBillingAddressTitle") : _resourceLoader.GetString("EditBillingAddressTitle"); BillingAddressViewModel.OnNavigatedTo(e, viewModelState); }