Reputation: 3301
When I create a cross-platform, the common project has both App.xaml
and MainPage.xaml
.
On the other hand, in this Working With Maps example, the developers eliminated MainPage.xaml
so that the common project only has App.xaml
.
So what's the difference between these two? And why did the tutorial above delete MainPage.xaml
when it's the one that has the text "Welcome to Xamarin.Forms!" that's displayed in the emulator?
The debugger hits both.
Upvotes: 4
Views: 1435
Reputation: 89169
App
is the main class of a Forms app that manages the lifecycle. It is responsible, among other things, for setting the initial UI page for the app.
In the sample you're looking at it assigns the MainPage
(the active UI page shown to the user) to an instance of TabbedPage
. MainPage.xaml
is just a default page that some templates create, it doesn't have any special meaning and can be replaced as needed.
public App ()
{
var tabs = new TabbedPage ();
...
MainPage = tabs;
}
Upvotes: 4