C#的新手让我感到困惑。我有这种情况:
private void result_Click(object sender, RoutedEventArgs e)
{
var data = from query in Event.Descendants("event")
select new EventManager
{
name = (string)query.Element("name"),
place = (string)query.Element("place"),
date = (DateTime)query.Element("date"),
time = (DateTime)query.Element("time")
};
myListBox.ItemsSource = data;
}
答案 0 :(得分:0)
您可以设置并稍后像这样获取ItemsSource
List<String> container = new List<String>();
listBox.ItemsSource = container;
List<String> retrieve = (List<String>) listBox.ItemsSource;
就像List一样,你可以拥有任何你想要的容器