in my MainPage.xaml’s constructor, I do some controls and want to navigate to Home page in some conditions like that:
NavigationService.Navigate(new Uri("/Home.xaml", UriKind.Relative));
But I take NullReferenceException above the code line. How can I fix that?
I suspect the navigation service is not setup correctly when the constructor is called. Try moving your navigate code to the OnNavigatedTo() method.