The most basic Silverlight application consistes of the following files:
HTML file that hosts the Silverlight application, it needs to contain a DIV with a unique ID and invokes the JS code that generates the Ssilverlight plugin, example:
<body>
<div id="SilverlightControlHost" >
<script type="text/javascript">
createSilverlight();
</script>
</div>
</body>
The createSilverlight() should invoke Silverlight.createObjectEx defined in Silverlight.js file distributed with the SDK, example:
function createSilverlight()
{
Silverlight.createObjectEx({
source: "Page.xaml",
parentElement: document.getElementById("SilverlightControlHost"),
id: "SilverlightControl",
properties: {
width: "100%",
height: "100%",
version: "1.1",
enableHtmlAccess: "true"
},
events: {onLoad: OnLoaded }
});
}
The third file is the XAML file that describes the UI. The most basic file looks like this:
<Canvas
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="parentCanvas"
Loaded="Page_Loaded"
Width="800"
Height="600"
Background="White"
>
</Canvas>
And optionally you will need JS files that contains the logic behind your application.
Thanks
Yasser Makram
My Blog: http://www.silverlightrecipes.com
Sr. Architect
Santeon Inc. Microsoft Silverlight Partner, Solution Provider