user310291
user310291

Reputation: 38190

How can I instantiate a page class in windows phone like in desktop Silverlight?

Windows phone template creates MainPage class but I can't see where it instantiates it anywhere in source code ?

So how does it work internally ?

Update: In Silverlight, Instantiation can be done in application startup, what would be the equivalent in Windows Phone ?

Upvotes: 1

Views: 149

Answers (2)

abhinav
abhinav

Reputation: 3217

The PhoneApplicationPage is a control. Yes, when you navigate to the page, object for the Page is internally created. You can, of course, refer to them in their namespaces, as with any other control. Like with any other framework, some things are taken care of, by the framework.

Upvotes: 1

CoderDennis
CoderDennis

Reputation: 13837

The only place I could find it was within the WMAppManifest.xml file. I would assume that the OS uses that to navigate to the MainPage when the app is launched.

<Tasks>
  <DefaultTask  Name ="_default" NavigationPage="MainPage.xaml"/>
</Tasks>

Upvotes: 2

Related Questions