Sharker Khaleed Mahmud Silverlight Tips & Tricks

August 12, 2010

82. Add DIV content over Silverlight Application

Filed under: Silverlight — Tags: , — Sharker Khaleed Mahmud | shamrat231 @ 8:07 AM

 [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.


    <div id=”flags” style=”text-align:center”>
        ImageButton ID=”imgbtnen” ImageUrl=”Images/en.png” runat=”server”
            Height=”16″ onclick=”imgbtnen_Click” />&nbsp;
        ImageButton ID=”imgbtnfr” ImageUrl=”Images/fr.png” runat=”server”
            Height=”16″ onclick=”imgbtnfr_Click”/>

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


    public partial class _default : System.Web.UI.Page
        protected void imgbtnen_Click(object sender, ImageClickEventArgs e)
            slculture.Attributes.Add(“value”, “en-us”);

        protected void imgbtnfr_Click(object sender, ImageClickEventArgs e)
            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



  1. […] Adding DIV Content over Silverlight Applications (Sharker Khaleed Mahmud) […]

    Pingback by Windows Client Developer Roundup 037 for 8/16/2010 - Pete Brown's — August 16, 2010 @ 6:30 AM

  2. Thanks,
    It was very useful.

    Comment by Anurag Gandhi — January 1, 2011 @ 6:10 PM

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: