Mar 18

Silverlight Application Life Cycle

Silverlight Application Life Cycle

The entry point of Silverlight applications is Silverlight Application class. It provides various services which is commonly needed by Silverlight application.

Silverlight lifecycle commences with opening a web page for hosting Silverlight plug-in. If the plug-in is not available, the web page prompts to install Silverlight browser plug-in. Later the browser activates the plug-in and starts downloading application package. This plug-in loads the Silverlight Common Language Runtime by which application domain for application is created.

Later, CLR creates an object of Application class followed by raising the Application Startup Event. There will be only one Application instance in any Silverlight-based application. Upon starting up the application instance provides several commonly used services by the application.

Silverlight is running on the client, not on the server as normal ASP.NET pages. But there are some events that will be executed on the client side in a specific order.

1. First the App constructor in the App.xaml file.

2. The App’s Applicaiton_Startup event which will be executed every time you open your Silverlight app.

3. The Main page’s Constructor. It will be the constructor of the page assigned to the RootVisual properly within the App’s Application_Startup event.

4. InitializeCompnent, only to make sure the components are singed to variables so you can use them. I hope this one will be removed in the future and be handled elsewhere.

5. If you have hooked up to the Loaded event within the Main Page Constructor, that event will then be executed, same with the rest event listen in the order they will be executed if you have hooked up to them.

6. Then the SizeChanged event.

7. Then the LayoutUpdated event.

8. Then GotFocus if you mark the Silverlight app.

9. If you navigate from your Silverlight app or close the Browser the App’s Application_Exit event will be executed.

Permanent link to this article:

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.