我想将可观察集合中的值从第 1 页传递到第 2 页。如何使用全局变量传递它?
public pg1()
{
InitializeComponent();
proxy.FindOrderCompleted += new EventHandler<FindOrderCompletedEventArgs>(proxy_FindOrderCompleted);
proxy.FindOrderAsync(custemail);
}
void proxy_FindOrderCompleted(object sender, FindOrderCompletedEventArgs e)
{
listBox1.ItemsSource = e.Result;
ObservableCollection<Order> Orders = this.listBox1.ItemsSource as ObservableCollection<Order>;
}
在 xmal 将其分配为
public ObservableCollection <Order> Orders
{
get; set;
}
public List<Order> FindOrder(string custemail, string orderstatus)
{
var findorder = from r in order.Orders where (r.CustEmail == custemail && r.OrderStatus == orderstatus ) select r;
return findorder.ToList();
}
如何将其分配给全局?