Silverlight 2 (RTW) RollMenu Demo

Home

This Silverlight RollMenu is created by Fons Sonnemans

It is initialized using this Menu.xml file which is set using the InitParameters.

You can download the C# source code and the example website here.

It is inspired by Microsoft Italy which uses Silverlight 1.0 and hardcoded menuitems.

asp:Silverlight server control

This RollMenu is configured in ASP.NET pages using an asp:Silverlight server control.

<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/ReflectionIT.Silverlight.RollMenu.xap"
                MinimumVersion="2.0.31005.0" Width="310" Height="115"
                InitParameters="MenuSource=../Menu.xml" PluginBackground="#808080" />

<OBJECT /> html tag

Plain HTML pages can use the following <OBJECT /> html tag. See example page.

<object id="Xaml1"  data="data:application/x-silverlight-2," type="application/x-silverlight-2" 
        height="115" width="310">
    <param name="source" value="ClientBin/ReflectionIT.Silverlight.RollMenu.xap" />
    <param name="MinRuntimeVersion" value="2.0.31005.0" />
    <param name="InitParams" value="MenuSource=../Menu.xml" />
    <param name="Background" value="#808080" />
    <a href="http://go2.microsoft.com/fwlink/?LinkID=114576&v=2.0">
        <img style="border-width:
            0pt;" alt="Get Microsoft Silverlight" src="http://go2.microsoft.com/fwlink/?LinkID=108181" />
    </a>
</object>

The presence of the IFrame prevents the Safari browser from caching the page. Safari caching prevents the Silverlight plug-in from reloading when the user navigates back to a previously-visited Silverlight page.

Silverlight.createObject() function of Silverlight.js

Plain HTML pages can also use the Silverlight.createObject() function of Silverlight.js. See example

<div id="silverlightControlHost">

    <script type="text/javascript">
        Silverlight.createObject("ClientBin/ReflectionIT.Silverlight.RollMenu.xap",  // source
            document.getElementById('silverlightControlHost'),     // parentElement 
            "slPlugin",                 // id for generated object element
            { width: "310", height: "115", background: "#808080", version: "2.0.31005.0" },
            {},
            "MenuSource=../Menu.xml",   // initParameters
            "context"                   // context helper for onLoad handler.
        );
    </script>

</div>

The document.getElementById('silverlightControlHost') fixes a problem when using a Firefox 3 browser.