Tutorials » Silverlight tutorials »

How to place a Silverlight control in a web page ?

This chapter explains how to place silverlight controls in a web page.

Each Silverlight Application project can have multiple .xaml pages. When you create a new Silverlight Application project, Visual Studio creates a default .xaml file called Page1.xaml. To add more .xaml pages, right click on the project in the Solution Explorer and select "Add" and "New Item". Then select "Silverlight User Control"

One or more Silverlight Applications can be placed in a web page using xaml tags as shown below:
<asp:Silverlight ID="Xaml1" runat="server"
Width="300" Height="300" />

In the above tag, the attribute "source" represents the name of the xap file which is the compiled output of the Silverlight project. The .xap files contains the compiled version of all .xaml files included in the Silverlight Application project.

When you compile the Silverlight Application project, it will be compiled to an assembly with the extension .xap. For example, if your Silverlight project name is "MySilverlightControl", when compiled, it will produce the assembly MySilverlightControl.xap

Each Silverlight project can have multiple .xaml files. Each .xaml file is like a page or form by itself. When you place a Silverlight Application in a web page, only one .xaml control will be visible at a time. Based on various user actions, you may dynamically open various .xaml pages (Just like you open forms in a windows application).

Next Chapter: How to set default .xaml page in a Silverlight control ?
Previous Chapter: Getting started with XAML tags
More Chapters: Silverlight Tutorials
More Tutorials: Tutorial Index

Top Contributors
TodayLast 7 Daysmore...

Awards & Gifts

Online Members

Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India