【问题标题】:In Silverlight, how to launch / navigate to another page?在 Silverlight 中,如何启动/导航到另一个页面?
【发布时间】:2008-10-24 21:02:07
【问题描述】:

在 Silverlight 中,我如何启动/导航到另一个页面?

【问题讨论】:

    标签: silverlight


    【解决方案1】:
    System.Windows.Browser.HtmlPage.Window.Navigate(
       new Uri( "http://www.google.com" ),
       "_blank"
       );
    

    如果您只想在当前浏览器窗口中导航,可以省略目标(“_blank”)。

    【讨论】:

      【解决方案2】:

      从另一个页面导航到另一个页面。

      Frame frame =this.parent as Frame;
      frame.navigate(new Uri("/Views/Details.xaml"),Uri.Relative);
      

      注意,您必须在 MainPage.xaml 中已有一个框架。 所以其他页面只是调用父级中的框架

      【讨论】:

        【解决方案3】:

        假设您正在编辑 Page 类的文件隐藏代码

        this.NavigationService.Navigate(new Uri("/OtherPage.xaml", UriKind.Relative));
        

        【讨论】:

        • 我认为 OP 是指网页,而不是 XAML 页面。
        【解决方案4】:

        为避免在使用 _blank 时弹出窗口被阻止的问题,请确保从 HyperlinkBut​​ton 控件的单击事件中调用 Navigate,如下所述:

        http://www.tjsblog.net/2010/10/20/opening-a-new-chrome-page-in-silverlight/

        【讨论】:

          【解决方案5】:

          大家也可以试试这个

          this.content=new (place the page name which You want to navigate);
          
                     but this code only works while navigate page having in same folder else You have to write like in given below manner
          

          this.Content = new Views.(放置您要导航的页面名称);

                   here in place of Views write the folder name where the page having...
          

          希望对大家也有帮助。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 2021-09-20
            • 1970-01-01
            • 2020-09-03
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多