I have some code in my view model which changes the application language, which then changes the text on some of the controls.
This is the DashboardViewModel
, which the Dashboard Page's data context is set to:
ApplicationLanguages.PrimaryLanguageOverride = languageCode;
ResourceContext.GetForCurrentView().Reset();
ResourceContext.GetForViewIndependentUse().Reset();
NavigationService.Navigate(typeof(DashboardPage));
With NavigationService.Navigate(typeof(DashboardPage));
I tried to force the page to refresh, with no success. How would I do this?
I have used an approach similar to @Vincent, but using
DateTime.Now.Ticks
as the parameter. This ensures that the value of the parameter is going to be different, which triggers the refresh.this line works very well for me.
NavigationService.Navigate()
is not doing anything if you're trying to navigate to the same page.On workaround is to add a parameter to your navigation request to force it.