images Workshop: Creating a Silverlight Project

Let's create a Silverlight project, using the Silverlight Business Application project template.

  1. In Visual Studio, select File images New images Project.
  2. Select the Silverlight subcategory from under the Visual C# category, in the Installed Templates tree (see Figure 1-2).
  3. Select Silverlight Business Application from the list of project templates.
  4. Give the project a name. We will be using AdventureWorks, because later workshops in this book will build on this one and connect to Microsoft's AdventureWorks sample database.
  5. Click OK.

Clicking OK will create a solution containing two projects: AdventureWorks (a Silverlight application) and AdventureWorks.Web (a web application). The web application hosts both the Silverlight application and any associated services that might serve data to it, and it is set as the start up project for the solution.

images

Figure 1-2. The New Project dialog in Visual Studio

images Note Silverlight applications don't need to be hosted in an associated web application. When a Silverlight application is the startup project in a solution, a HTML page will be automatically generated to host it, and it will run in the browser using a local file URL. However, if you're exposing services to the Silverlight application (and most business applications do), an associated web application to host both them and the Silverlight application will usually be necessary.

You can now compile and run the project without making any changes to it. As Figure 1-3 shows, you get a reasonable starting point for your application.

images

Figure 1-3. User interface created by the Silverlight Business Application project template

Let's now explore the content of this application and its underlying structure.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset