我ListBox
填充了来自 XML 的数据。到目前为止很好,问题是我在尝试墓碑时遇到了一些错误。
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
State["listbox1"] = listBox1.ItemsSource;
}
然后:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
if (State.ContainsKey("listbox1"))
{
listBox1.ItemsSource = (IEnumerable)State["listbox1"];
}
}
当我点击开始按钮时,我已经收到错误消息。App.xaml.cs
打开,下面的线变成黄色
System.Diagnostics.Debugger.Break();
我也使用了墓碑助手,但它没有返回我的列表框中的项目。