Harsha M V
Harsha M V

Reputation: 54949

Creating a Simple ListBox

I am new to Windows Phone development and i want to create a simple ListBox.

I have an Array with 10 Names which i want to display in a list Box.

string[] names = new string[10] {"Matt", "Joanne", "Robert", .........};

Now i want to use this Array to feed the listBox dynamically and show it. enter image description here

Can someone help me with an Example on how to do this.

Upvotes: 0

Views: 171

Answers (2)

anderZubi
anderZubi

Reputation: 6424

You have to set the array as the ItemSource for the ListBox:

listBox.ItemSource = names;

Upvotes: 1

MrBlue
MrBlue

Reputation: 840

I'm not familiar with Windows Phone development, but in winforms it'd be listbox.Items.AddRange(names);

Upvotes: 1

Related Questions