我试图将ListItems添加到ListBox(ListBox3),这取决于另一个ListBox(ListBox1)的selectedItem。问题是,这些项目不会添加到列表框中。WP7:根据来自另一个列表框的输入填充列表框
下面的代码:
private void createlist()
{
if (listBox1.SelectedValue.ToString().Equals("EPL"))
{
ListBoxItem manchesterunited = new ListBoxItem();
manchesterunited.Content = "Manchester United";
listBox3.Items.Add(manchesterunited);
}
}
private void listBox1_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
createlist();
}
createlist()做变化,被称为在ListBox1中的SelctionChanged()事件。
新来C#和WP7编程,任何帮助将不胜感激。