Reputation: 73
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?
Upvotes: 0
Views: 437
Reputation: 2216
I suspect the navigation service is not setup correctly when the constructor is called. Try moving your navigate code to the OnNavigatedTo() method.
Upvotes: 1