如何在 windows 商店页面之间传递多个参数?
How to pass multiple arguments between windows store pages?
遵循 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 个列表)。怎么做?
如果您想传递两个集合,请创建一个 class 并在 class 中初始化您的集合,并将其作为参数传递。
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
}
}
遵循 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 个列表)。怎么做?
如果您想传递两个集合,请创建一个 class 并在 class 中初始化您的集合,并将其作为参数传递。
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
}
}