I’ve remembered one day, I am doing my Imagine Cup coding part in Silverlight.

Suddenly, List of check box, List of Radio Button , List of Pic with Description come across in my mind.

Then, I think of a good way to do so. After a moment, I have these ideas.


Let me briefly explain. I will use a stackpanel to store the items for each item in list. Then add the stackpanel into the list.

Let say we have a list of checkbox and a list of redio button.

It is easy for us to create the list like this.

ListBox lb = new ListBox();
for (int i = 0; i <= 7; i++)
    CheckBox cb = new CheckBox(); 
    cb.Content = "Choice" + i.ToString();
    // Of course you can add some Event here for


Case of Radio button  is the similar, so I dont explain so much here.

But for the case of Pic with Desc…

I will do like this.

ListBox lb = new ListBox();
for (int i = 0; i <= 7; i++)
    Image Img = new Image();
    BitmapImage bi = new BitmapImage(); 
    string k = "pic" + i.ToString();
    TextBlock tb = new TextBlock();
    tb.Text = k;
    k += ".jpg";
    bi.UriSource = new Uri(k, UriKind.Relative);
    Img.Source = bi;
    StackPanel sp = new StackPanel();

Hope this can help more people to know more about Silverlight.

Live with Light!

Steve Wong (Hong Kong)

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 )

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