I am developing an in-house application for devices that run Windows 10 IoT Mobile and so use UWP. I am using the Mvvm Light toolkit. The application needs a user to sign on (nothing fancy, just record their name for logging purposes) and so if this value has not been set (via saved settings), the main ViewModel of the application navigates to a sign-in page.
I have come across a problem using the Mvvm Light Navigation Service. If you try to navigate from within a ViewModel's constructor, nothing happens.
For example, in Visual Studio, create a new Mvvmlight (Win10Univ) project. This creates an example app with some navigation.
Now put the navigation code in the constructor eg:
public MainViewModel(IDataService dataService, INavigationService navigationService)
{
_dataService = dataService;
_navigationService = navigationService;
_navigationService.NavigateTo(ViewModelLocator.SecondPageKey, "12321");
Initialize();
}
This new line of code appears to do nothing, with the debbugger stepping straight over it, and nothing in the Output window.
One thought, the emulator is still showing the splash screen at this point and so could it be due to the application not being fully created at that point?
Any ideas?