What’s new in Xamarin.Forms 1.3 : Inherited App Class

With the new release of Xamarin.Forms 1.3 version, the App Class has its new Avatar.

The Older version of App Class was just a class with static methods.
OldXamarinAppClass

Unlike the older version, the new version is an inherited class from the Xamarin.Forms.Application class.
NewXamarinAppClass

Summary of improvements

Addition of new life cycle events :

We can handle separate events during different phases of app interaction life cycle.

  • onStart :- Allows us to handle the app start up. We can write code here to get executed during on app start up.
  • onSleep :- We can write code here to get executed while app in entering into the sleep/minimize mode.
  • onResume :- Code can be executed after the app regains the focus.

Self static object :
Application class uses a static instance of its own, which is named as Current. It can be accessed through out the application.

MainPage attribute :
MainPage is an attribute of the Application Class of type ContentPage. As the name suggest, we can assign the root page of the application to this attribute.

Properties :
Not to be confused, this is an attribute of the Application Class. It contains the Dictionary object. We can read/write application level global variables to it for further use in a Key and Value pair format.

Resources :
Application Class Resources attribute can store the resources for application use. This attribute is of type ResourceDictionary.We can add Implicit Styles (in XAML) and Key Value pair strings to it.

Happy coding šŸ™‚

Categories: Android, Cross Platform Mobile App, iOS, Visual Studio, Windows Phone, Xamarin

Leave a Reply

%d bloggers like this: