We can start the app for the first time as follows:
- Open up App.xaml.cs by expanding the App.xaml node in the .NET Standard library.
- Locate the constructor.
- Add a using statement for DoToo.Views and add the following code line in bold:
public App ()
{
InitializeComponent();
MainPage = new NavigationPage(Resolver.Resolve<MainView>());
}
The line we have just added resolves the MainView class (and all its dependencies, including MainViewModel and TodoItemRepository) and wraps it in NavigationPage. NavigationPage is a page defined in Xamarin.Forms that adds a navigation bar and enables the user to navigate to other views.
In Xamarin.Forms 4, a brand new way of declaring the structure of an app has been added. It's called Shell and we have a whole chapter about it in this book. However, to become a good Xamarin developer, you need to know the basics, and the basics of navigating in Xamarin.Forms uses the good old NavigationPage control.
That's it! Now, your project should start. Depending on the platform you are using, it might look as in the following screenshot: