[tweetmeme source=”shamrat231” only_single=false]In this entry, I will show you how to add html content over Silverlight application. For demonstration purpose, I will reuse Mike Snow localization sample.
So basically, if you change the culture at param tag, the Silverlight culture changes. Now lets add some flag in our .aspx page for both culture.
Default.aspx
<div id=”flags” style=”text-align:center”>
ImageButton ID=”imgbtnen” ImageUrl=”Images/en.png” runat=”server”
Height=”16″ onclick=”imgbtnen_Click” />
ImageButton ID=”imgbtnfr” ImageUrl=”Images/fr.png” runat=”server”
Height=”16″ onclick=”imgbtnfr_Click”/>
</div>
In here, I just added some flag in our .aspx page and on button click handler. I will modify the value of the param from .aspx.cs code behind as shown below
<param id=”slculture” runat=”server” name=”uiculture” value=”en-us” />
Now on code level
Default.aspx.cs
public partial class _default : System.Web.UI.Page
{
protected void imgbtnen_Click(object sender, ImageClickEventArgs e)
{
slculture.Attributes.Remove(“value”);
slculture.Attributes.Add(“value”, “en-us”);
}
protected void imgbtnfr_Click(object sender, ImageClickEventArgs e)
{
slculture.Attributes.Remove(“value”);
slculture.Attributes.Add(“value”, “fr-ca”);
}
}
Now, lets run the application.
Now as the title of the entry suggested, I will put the div section over my Silverlight application. Now, lets set our div to absolute position and make the Silverlight content relative.
<div id=”flags” style=”text-align:center;position:absolute;”>
Now if you run the application, our Silverlight app will hide the whole div section. Basically this happens because we have not yet set our sl app to windowless true. So change the param tag to
and here is the output
As always, you can download the source code from here [download link]
Sharker Khaleed Mahmud
Web Developer
[…] Adding DIV Content over Silverlight Applications (Sharker Khaleed Mahmud) […]
Pingback by Windows Client Developer Roundup 037 for 8/16/2010 - Pete Brown's 10rem.net — August 16, 2010 @ 6:30 AM
Thanks,
It was very useful.
Comment by Anurag Gandhi — January 1, 2011 @ 6:10 PM