How to insert two Silverlight applications within an HTML page
I have recently started doing the coding in Silverlight application. So frankly speaking, I am not having great ideas about it. Now I am having the problem while inserting the two different Silverlight applications in a HTML page. I have tried to do lot of things but was not succeeded. So lastly I gave up and thought to take some help from you guys. I have also tried to search this problem on Internet but didn't find any appropriate solutions. So please tell me how to insert two Silverlight applications within an HTML page? I am expecting some quick response from your side. :notworthy
Re: How to insert two Silverlight applications within an HTML page
A Silverlight application is embedded in an HTML page using a tag <OBJECT>. This tag allows <OBJECT> reference the Silverlight plug-in in your page by specifying a few parameters such as the source of the XAML file, the background color, the display mode and so on.
Re: How to insert two Silverlight applications within an HTML page
Theoretically, it suffices to duplicate the tag <OBJECT> to create a second Silverlight application to your page, as follows:
HTML Code:
<html>
<body>
<Object width = "400" height = "300" id = "SilverlightControl1"
type = "application / silverlight-x">
<param name= "source" value = "Page.xaml" />
</ Object>
<Object width = "400" height = "300" id = "SilverlightControl2"
type = "application / x-silverlight">
<param name= "source" value = "Page.xaml" />
</ Object>
</ Body>
</ Html>
However, this approach to include your Silverlight application in your HTML page is abstinence from the "Fallback" (silverlight.js), that is to say, among other things, the entire management of versioning plugin Silverlight sense software term. Something that is not recommended.
Re: How to insert two Silverlight applications within an HTML page
In practice it will therefore have to integrate so cleanly Silverlight <OBJECT> two tags in your page with the fallback management and event management for each application. As well as the fact the software Expression Blend for one movie I'll propose a solution using the files Silverlight.JS & CreateSilverlight.JS redesigned.
Re: How to insert two Silverlight applications within an HTML page
Introducing the new function call createSilverlight within the HTML page:
HTML Code:
<Html> <body>
... <Div id = "SLSponsor" class = "sponsor">
<Script type = "text / javascript">
createSilverlight ('Sponsor.xaml' new Sponsor.Page (), 'SLSponsor');
</ Script>
</ Div> ...
</ Body> </ html>
I am sure that this coding will help you definitely. :thumbup1:
Re: How to insert two Silverlight applications within an HTML page
Here is the new file and function CreateSilverlight.JS "createSilverlight" remodeled :
HTML Code:
createSilverlight function (xaml_page, sl_scene, parent_element)
(
Silverlight.createObjectEx ((
Source: xaml_page,
parentElement: document.getElementById (parent_element)
id: "SLControl_" + parent_element,
properties: (
width: "100%"
height: "100%"
version: "1.0"
)
events: (
onLoad: Silverlight.createDelegate (sl_scene, sl_scene.handleLoad)
)
));
)
Unlike ASP.NET Futures XAML and control, I want to say that no solution is dependent on the hosting server and is compatible with applications such as PHP, Java,. NET.