开发者

How to integrate siilverlight with web

I able to integrate silverlight xap file in website page by providing the source parameter with correct value. Something like:

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
          <param name="source" value="ClientBin/Demo3.xap"/>
          <param name="onError" value="onSilverlightError" />
          <param name="background" value="white" />
          <param name="minRuntimeVersion" value="4.0.50826.0" />
          <param name="uiculture" value="<%= System.Threadi开发者_StackOverflowng.Thread.CurrentThread.CurrentUICulture %>" />
          <param name="culture" value="<%= System.Threading.Thread.CurrentThread.CurrentCulture %>" />
          <param name="autoUpgrade" value="true" />
          <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
              <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
          </a>
        </object>

But, problem is my silverlight project has multiple pages which i want to show separately at different web pages at a site.

Query: How to modify source param tag to load the particular xaml page?

If this is not possible than how to achieve this scenerio?


StartupEventArgs.InitParams Property

Silverlight handler:

private void Application_Startup(object sender, StartupEventArgs e)
{
    // look into e.InitParams property and let's say we can get the following variable:
    bool showPage1;

    // let's say we have two pages - Page1.xaml and Page2.xaml
    RootVisual = showPage1 ? (UIElement) new Page1() : new Page2();
}

html (see initParams):

<object id="slPlugin1" width="300" height="50"
        data="data:application/x-silverlight-2," 
        type="application/x-silverlight-2" >
        <param name="source" value="ClientBin/SilverlightApplication.xap"/>
        <param name="initParams"
            value="id=slPlugin1,embeddingTechnique=objectElement"/>
        <!-- Installation HTML omitted. -->
    </object>    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜