创建一个简单的ListBox
问题描述:
我是Windows Phone开发新手,我想创建一个简单的ListBox。创建一个简单的ListBox
我有一个数组有10个名字,我想要在列表框中显示。
string[] names = new string[10] {"Matt", "Joanne", "Robert", .........};
现在我想用这个数组来动态地提供列表框并显示它。
有人可以帮我一个关于如何做到这一点的例子。
答
你必须设置阵列作为的ItemSource为ListBox:
listBox.ItemSource = names;
答
我不熟悉Windows Phone的开发,但在的WinForms它会是listbox.Items.AddRange(names);