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

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...