Closed liptonbeer closed 8 years ago
Hi, @JerryNixon I have reproduced the problem with incrementally calling Navigate method in attached project.
The problem can be reproduced when: On MainPage NavigationCacheMode is Enabled On DetailsPage NavigationCacheMode is Disabled
After app is launched you have to click to HamburgerButton to initialize menu. I don't know why it is not initializing at startup (in my home project, menu is initializing at startup and while it is doing so, the SetSelected method is called and additional navigation to MainPage is made -> my second issue). While initializing menu the additional navigation to MainPage is made (just like in my home project). Then when you click on first ListViewItem one navigation is made After going back and clicking for example second ListViewItem navigation is called two times and you have to click back button twice to come back to MainPage.
After I've changed in NavigationsService:
await WindowWrapper.Current().Dispatcher.DispatchAsync(() => { NavigateTo(e.NavigationMode, parameter, Frame.Content); }, 1);
to this:
await WindowWrapper.Current().Dispatcher.DispatchAsync(() => { NavigateTo(e.NavigationMode, parameter, Frame.Content); }, 0);
the navigation to DetailsPage was made only once, but in background NavigationService.Navigation method was called many times and only one returns true.
Artur
I'm sorry @liptonbeer , I double-checked and cannot repro this in Minimal. I will test with your project next.
@JerryNixon, change the line:
await WindowWrapper.Current().Dispatcher.DispatchAsync(() => { NavigateTo(e.NavigationMode, parameter, Frame.Content); }, 0);
to
await WindowWrapper.Current().Dispatcher.DispatchAsync(() => { NavigateTo(e.NavigationMode, parameter, Frame.Content); }, 1);
in NavigationService before testing.
Maybe it is because the MvvmLigth framework, but it should't be that.
Nope. I updated the MVVM sample with your specs and still could not repro this.
Thats strange :/ Maybe it's something on my machine config. I will recheck it again.
Thanks anyway for your time you spent on checking it.
Hi, I have a Master-Detail scenario based on ListView in MainPage and ListviewItem details in DetailsPage. Navigation is based on ItemClick event bind to DelegateCommand in MainPageViewModel. In the first navigation from MainPage to DetailsPage Navigate method is called once. Then while second navigation (after going back with backbutton) the Navigate method is called twice. While third navigation is called thrice, and so on. I couldn't found out is it a template issue or Windows 10 mobile issue.
Also I don't understand why the NavigateTo method is called by a dispatcher with 1 ms delay? This makes my app not to load properly the view because it is loaded without ViewModel.NavigateTo method called in a first navigation. After I have changed the delay from 1 to 0, everything works perfectly. And one more thing :) Why don't u use there a Dispatcher property from NavigationService?
Artur