如何在Windows商店页面之间传递多个参数?

时间:2015-01-01 21:15:06

标签: c# visual-studio windows-store-apps

this msdn教程之后,它展示了如何将参数从一个页面传递到另一个页面。

private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
{
    this.Frame.Navigate(typeof(BasicPage2), tb1.Text);
}

private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
{
    string name = e.NavigationParameter as string;

    if (!string.IsNullOrWhiteSpace(name))
    {
        tb1.Text = "Hello, " + name;
    }
    else
    {
        tb1.Text = "Name is required.  Go back and enter a name.";
    }
}

但是如何传递多个参数?

我需要传递2个集合(2个列表是特定的)。怎么做?

1 个答案:

答案 0 :(得分:0)

如果要传递两个集合,请创建一个类并在类中初始化集合并将其作为参数传递。

class collectionscontainer
{
  private list<urlist> list1;
  private list<urlist> list1;
}
Class Classname
{
  public void Methord(collectionscontainer c)
  {
    //hear u will get access of both lists 
  } 
}