Inside my MainPage
constructor I\'m using NavigationService
to navigate to another page, but I\'m getting the error:
object refe
The page you're navigating to hasn't yet been created in the c'tor. "Loaded" fires after the objects are all created, and is the right spot for doing things like navigating to another page and such.
A little late to the party, but from what MSDN says (and mentioned by @JustinAngel's comment above), you should actually use the OnNavigatedTo
event, rather than Loaded
. While Loaded
still works,
Typically, you use the OnNavigatedTo method instead of creating an event handler for the Loaded event. The OnNavigatedTo method is preferable because it is only called once for each time the page becomes active. The Silverlight framework raises the Loaded event each time the element is added to the visual tree, which potentially can happen more than once when activating a page.