Binding a List of String to ListBox without ItemTemplate

In one of my previous post , i explained about the the Databinding the ListBox in Windows Phone 7 that included the Item Template .

How do you bind just the List of String to a ListBox without any ItemTempalates ?

Very simple , just create the List of string and assign it to the ItemSource Property of the ListBox similar to the previous blog post .

private void FillListBox()
{
List Lst = new List();
Lst.Add("Senthil Kumar");
Lst.Add("Windows Phone");
Lst.Add("Microsoft .NET");
listBox1.ItemsSource = Lst;
}

Here’s the XAML code of the ListBox

<ListBox Height="596" Name="listBox1" Width="380" >

<ListBox.ItemTemplate>

 

Leave a Reply