Creating a global App.xaml
In all Xamarin.Forms
projects we must create an Application
file that inherits the Application
class. We are going to extend this Application
file and create a global resource dictionary. If you came from WPF you will recognize the use of a global resource dictionary that we can reference in all XAML sheets. This global resource dictionary is kept in the App.xaml
file. It will have references to different converters, styles, and data templates. Rather than declaring static resource dictionaries at the top of every ContentPage
or ContentView
, we want to create only one dictionary that every XAML interface can access. This means we only create one dictionary at startup throughout the entire life of the application, rather than creating multiple dictionaries on views when they are displayed.
Let's create a new ContentPage
, call it App.xaml
, and place it in the Stocklist.XamForms
project. We can now remove the App.cs
file that already exists in this project. Inside...