<script type="text/javascript" src="Silverlight.js"></script>
<script type="text/javascript">
var IsLSC = true;
// function create Object block inside Div tag
function CreateSilverlightMenuTree(XapPath) {
var userDetails = "";
var objectValue = Silverlight.createObject(
"/ClientBin/" + XapPath, // source
null, // parent element
"slPlugin", // id for generated object element
{
width: "100%", height: "100%", background: "transparent", windowless: "true",
version: "5.0.60401.0"
}, { onError: onCustomError, onLoad: onCustomLoad },
"userData=" + userDetails,
"context" // context helper for onLoad handler.
);
var divObj = document.getElementById("silverlightControlHost");
divObj.innerHTML = objectValue;
}
function onCustomError() {
window.status += " Error in loading window";
}
function onCustomLoad() {
window.status += " Window loaded";
}
//function swap between two xap file dynamically
function SwitchXap() {
var paramObj= "";
if (IsLSC) {
paramObj = "LSC.xap";
IsLSC = false;
}
else {
paramObj = "SilverlightNetwork.xap";
IsLSC = true;
}
CreateSilverlightMenuTree(paramObj);
}
</script>
</head>
<body>
<form id="form1" runat="server" style="height:100%">
<input id="Button1" type="button" value="Swap" onclick="SwitchXap()" />
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param id="paramXap" name="source" value="ClientBin/SilverlightNetwork.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="5.0.60401.0" />
<param name="autoUpgrade" value="true" />