Wednesday, January 11, 2012

Basic Silverlight Application

Hi,
    Today we will design one simple Silverlight Application.
Before going to start Silverlight you should have the 
following tools installed in your computer.
1] Microsoft Silverlight 4 Tools for Visual Studio 2010
2] Silverlight 4 Runtime
3] Developer Runtime for Windows (32 bit) 
4] Please visit Silverlight.Net if still having any problem.

 So lets start with silverlight application.
  1. Start Visual Studio 2010.
  2. On the File menu, click New and then Project.
    The New Project dialog box appears.
  3. Expand the Visual C# or the Visual Basic node and select Silverlight.
  4. Select Silverlight Application.


  

















5. Specify a name and a location for the application and then click OK.
    The New Silverlight Application dialog box appears.

















6 .Select a method for hosting your Silverlight application.
        a. Uncheck the Host the Silverlight application in a new Web site check box if you do not want to use a   Web site to host your Silverlight application. Instead, an HTML test page will be generated to host your application.
        b. Check the Host the Silverlight application in a new Web site check box if you want to add a separate ASP.NET Web site or ASP.NET Web Application Project to your solution to host the Silverlight application. If you select this option, you must also specify the New Web project name and New Web Project Type.
        c. From the Silverlight Version drop-down list, select the version of Silverlight that you want to target.
        d. Click the OK button.


A Silverlight application project contains the following configuration, assembly references, and code files:
  • AppManifest.xml
    This is the application manifest file that is required to generate the application package. You must not edit this file.
  • AssemblyInfo.cs or AssemblyInfo.vb
    This file contains the name and version metadata that is embedded into the generated assembly.
  • .xap file
    This is the Silverlight application package. It is generated when the Silverlight application project is built. An application package is a compressed zip file that has a .xap file extension and contains all the files that you need to start your application. For more information about a Silverlight application package, see Application Structure.
  • A Silverlight application project contains references to the following assemblies:
    • mscorlib.dll
    • System.dll
    • System.Core.dll
    • System.Net.dll
    • System.Windows.dll
    • System.Windows.Browser.dll
    • System.Xml.dll
  • MainPage files
    The MainPage class is used to create the user interface for the Silverlight application. The MainPage class derives from UserControl. You can implement the MainPage class by using MainPage.xaml for XAML markup and MainPage.xaml.cs or MainPage.xaml.vb for the code-behind.
  • App files
    The App class is required by a Silverlight application to display the application user interface. The App class is implemented by using App.xaml and App.xaml.cs or App.xaml.vb. The App class is instantiated by the Silverlight plug-in after the application package (.xap file) is created.
  • Test Page
    A single HTML page (TestPage.html) is generated to host your application if you do not check the Host the Silverlight application in a new Web site check box in the New Silverlight Application dialog box.

No comments:

Post a Comment