【问题标题】:Pass value from one xaml page to another xaml page in silverlight将值从一个 xaml 页面传递到 silverlight 中的另一个 xaml 页面
【发布时间】:2016-05-11 08:47:44
【问题描述】:

您好,我是 Silverlight 的新手,我想将值从一个 Xaml 页面传递到 Silverlight 中的另一个 Xaml 页面。我得到了一些解决方案,因为

protected void btn_click(object sender, RoutedEventArgs e)
{ 
    NavigationService.Navigate(new Uri("/Page1.xaml?key1"=txtname.Text, UriKind.Relative));
}

但我发现其中有一个错误

非静态字段、方法、属性 System.Windows.Navigation.NavigationService.Navigate(System.Uri)' 需要对象引用

【问题讨论】:

  • 试试这个链接它对你有帮助stackoverflow.com/questions/12444816/…
  • 我收到一个错误:非静态字段、方法、属性 'System.Windows.Navigation.NavigationService.Navigate(System.Uri)' 需要对象引用,所以解决方案您的链接中未提及

标签: asp.net silverlight-5.0


【解决方案1】:

语法问题。除非是错别字

protected void btn_click(object sender, RoutedEventArgs e)
{ 
    NavigationService.Navigate(new Uri("/Page1.xaml?key1"=txtname.Text, UriKind.Relative));
}

应该改为...

protected void btn_click(object sender, RoutedEventArgs e)
{ 
    NavigationService.Navigate(new Uri("/Page1.xaml?key1="+txtname.Text, UriKind.Relative));
}

注意变化

"/Page1.xaml?key1"=txtname.Text

"/Page1.xaml?key1="+txtname.Text

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多