Tuesday, October 30, 2012

Silverlight-An Introduction

It is a powerful development tool for creating interactive user interface for window, web and mobile application. It is an application framework for creating rich internet applications. The runtime environment is available for silverlight as free plug-in powered by the .NET framework and compatible with any browser, device and operating system.
Working with Silverlight

Steps to be followed:
1. Start Visual Studio and go to File->New->Website.

2.New Web Site window will populate.Select ASP.NET Web Site and click on button Ok.


3. In Solution Explorer, right click on project name Silverlight and select Add New Item.


4. Add New Item window will populate.Select Silverlight Application from template list and click on button Add.


5. Add Silverlight Application window will populate.Click on button Ok.


6. Silverlight Application projet window will populate.


Notes:

1. Whenever we create new Silverlight Application project, it always contains two files such as  MainPage.xaml and App.xaml as well as code behind class files that are associated with them.
2. The App.xaml file is used to declare resources, such as brush and style objects that are shared across the application. The Application code-behind class for the App.xaml file can be used to handle application level events – such as
     1. Application Startup
     2. Application Exit and
    3. Application_UnhandledException.
3. The Page.xaml file is by default the initial UI control that is loaded when the application activates. Within it we can use UI controls to define our user interface, and then handle events off of them within the Page code-behind class.
4. Whenever we build our project, Visual Studio will by default compile the code and .XAML markup into a standard .NET assembly file, and then package it into .xap file.
5. Xap file is a compressed result of the silverlight application which contains application manifest file, compiled output assembly and other recourses used by silverlight application

7. Drag a control TextBlock from Toolbox inside Grid. Add a text attribute to the TextBlock element and sets it a value of “Hello World.”We can see Hello World in the Grid. in the below mentioned screenshot.


8. Run the application by pressing F5 and it will launch test web page that hosts our application.


No comments:

Copyright © Codingnodes,2014.All Rights Reserved.