Cloud Training (Online)




Q&A #41 – NavigationService Cannot be used in the Constructor of the page.

Did you know that NavigationService cannot be used in constructor of the Windows Phone Page (PhoneApplicationPage).

Q&A #41 – NavigationService Cannot be used in the Constructor of the page.

When attempting to use the NavigationService within the constructor of the page, you will receive the following error.

Q&A #41 - NavigationService Cannot be used in the Constructor of the page.

“An exception of type ‘System.NullReferenceException’ occurred in MobileOSGeek.DLL but was not handled in user code

Additional information: Object reference not set to an instance of an object.”

It is therefore necessary to wait until the Form’s OnNavigatedTo method is called before one uses the NavigationService within the page.

Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.