Silverlight多页面,浏览器后退/前进

时间:2022-07-01 08:10:34

I can present multiple pages in Silverlight using

我可以使用Silverlight呈现多个页面

Content = new DetailsPage();

However is this can be confusing to a user who may not even know the page is in Silverlight and would be expecting to hit the back button on the browser. Obviously I can add my own buttons but this doesn't seem right.

然而,对于可能甚至不知道该页面位于Silverlight中并期望点击浏览器上的后退按钮的用户而言,这可能会让人感到困惑。显然我可以添加自己的按钮,但这似乎不对。

How can I allow "normal" browser navigation using the back/forwards button?

如何使用后退/前进按钮允许“正常”浏览器导航?

2 个解决方案

#1


In Silverlight 2, you can still handle navigation. It's just a more manual process.

在Silverlight 2中,您仍然可以处理导航。这只是一个更加手动的过程。

Call

HtmlPage.Window.NavigateToBookmark("blah");

to add the "#blah" to the end of the URL. Call

将“#blah”添加到URL的末尾。呼叫

string bookmark = HtmlPage.Window.CurrentBookmark;

to find out where you currently are. People are also tying into jquery/Asp.net AJAX libraries to use their navigation support.

找出你现在的位置。人们也在使用jquery / Asp.net AJAX库来使用他们的导航支持。

In Silverlight 3, you can use the Navigation Framework to do some of this automatically. File->New Project->Silverlight Navigation Project.

在Silverlight 3中,您可以使用导航框架自动执行其中一些操作。文件 - >新项目 - > Silverlight导航项目。

#2


You should really formulate a question.

你应该真正提出一个问题。

I'll assume that you want to know how to achieve multi-page navigation with browser back-button support.

我假设您想知道如何通过浏览器后退按钮支持实现多页面导航。

There one simple answer, which is to use Silverlight 3 where it is supported out of the box, as well as in-app navigation using the address bar.

有一个简单的答案,即使用支持开箱即用的Silverlight 3,以及使用地址栏进行应用内导航。

Release date is set for july 10, so there's not much longer to wait. Be careful, you cannot at the moment install both Silverlight 2 and 3 on one machine, and there is no end-user plugin available (only developper runtimes, to install manually).

发布日期定在7月10日,所以等待的时间不会太长。小心,你现在不能在一台机器上安装Silverlight 2和3,并且没有最终用户插件可用(只有开发者运行时,才能手动安装)。

#1


In Silverlight 2, you can still handle navigation. It's just a more manual process.

在Silverlight 2中,您仍然可以处理导航。这只是一个更加手动的过程。

Call

HtmlPage.Window.NavigateToBookmark("blah");

to add the "#blah" to the end of the URL. Call

将“#blah”添加到URL的末尾。呼叫

string bookmark = HtmlPage.Window.CurrentBookmark;

to find out where you currently are. People are also tying into jquery/Asp.net AJAX libraries to use their navigation support.

找出你现在的位置。人们也在使用jquery / Asp.net AJAX库来使用他们的导航支持。

In Silverlight 3, you can use the Navigation Framework to do some of this automatically. File->New Project->Silverlight Navigation Project.

在Silverlight 3中,您可以使用导航框架自动执行其中一些操作。文件 - >新项目 - > Silverlight导航项目。

#2


You should really formulate a question.

你应该真正提出一个问题。

I'll assume that you want to know how to achieve multi-page navigation with browser back-button support.

我假设您想知道如何通过浏览器后退按钮支持实现多页面导航。

There one simple answer, which is to use Silverlight 3 where it is supported out of the box, as well as in-app navigation using the address bar.

有一个简单的答案,即使用支持开箱即用的Silverlight 3,以及使用地址栏进行应用内导航。

Release date is set for july 10, so there's not much longer to wait. Be careful, you cannot at the moment install both Silverlight 2 and 3 on one machine, and there is no end-user plugin available (only developper runtimes, to install manually).

发布日期定在7月10日,所以等待的时间不会太长。小心,你现在不能在一台机器上安装Silverlight 2和3,并且没有最终用户插件可用(只有开发者运行时,才能手动安装)。