user1285383
user1285383

Reputation: 73

windows phone 7 Navigate Uri

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

Answers (1)

gbanfill
gbanfill

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

Related Questions