Data binding of itemscontrol in Silverlight 3.0
- by jmkarthik
I am trying to define an itemscontrol and data bind it to a List and the code is as below.
XAML
Item Class
public class Item
{
public string val;
}
XAML.cs
public MainPage()
{
InitializeComponent();
List<Item> items = new List<Item>();
Item item1 = new Item();
item1.val = "iasl;fdj1";
items.Add(item1);
Item item2 = new Item();
item2.val = "iasfdkasdkljf2";
items.Add(item2);
ic.ItemsSource = items;
}
The items are displayed when I run this. Am I missing something?