我可以使用Btn_Click方法调用NavigationService
private void Com_Click(object sender, RoutedEventArgs e)
{ string test = "Com";
var x = NavigationService.Navigate(new Uri(@"/PageList.xaml" + "?msg1=" + test, UriKind.Relative));
}
但我不能以这种方式叫同一个服务
public MainPage()
{
InitializeComponent();
...
Test();
}
private void Test()
{ string test = "Com";
var x = NavigationService.Navigate(new Uri(@"/PageList.xaml" + "?msg1=" + test, UriKind.Relative));
}
答案 0 :(得分:0)
尝试不使用var x =
:
private void Test()
{
string test = "Com";
NavigationService.Navigate(new Uri(@"/PageList.xaml" + "?msg1=" + test, UriKind.Relative));
}