繁体   English   中英

Windows Phone Silverlight中的NavigationService

[英]NavigationService in Windows Phone Silverlight

我可以使用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));
}

尝试不使用var x =

  private void Test()
  {  
    string test = "Com";
     NavigationService.Navigate(new Uri(@"/PageList.xaml" +   "?msg1=" + test, UriKind.Relative));
  }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM