Silverlight、子窗口和后退按钮

发布于 2024-12-25 08:05:25 字数 216 浏览 2 评论 0原文

我正在使用 Silverlight 导航风格的应用程序。

有没有办法让浏览器的后退按钮关闭子窗口而不是返回页面?
现在,“后退”按钮会返回,同时保持子窗口打开。

编辑

这就是我希望后退堆栈的样子:

  • 编辑标题(子窗口)
  • 查看记录(页面)
  • 主页(页面)

I am using a Silverlight Navigation style application.

Is there a way to back the browser's Back button close a ChildWindow instead of going back a page?
Right now the Back button goes back while leaving the ChildWindow open.

EDIT

This is what I would like my back-stack to look like:

  • Edit Title (ChildWindow)
  • View-Record (Page)
  • Home (Page)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我喜欢麦丽素 2025-01-01 08:05:25

我最终做的是取消导航,然后将旧的哈希标签推回到标题中。

    protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
    {
        if (CharacterSheet.HasOpenDialogs)
        {
            e.Cancel = true;
            Dispatcher.BeginInvoke(new Action(() =>{
                HtmlPage.Window.CurrentBookmark = NavigationService.CurrentSource.ToString().Replace(@"\", @"/");
                CharacterSheet.CloseDialogs();
            }));
        }
        base.OnNavigatingFrom(e);
    }

What I ended up doing is canceling the navigation and then pushing the old hash tag back into the title.

    protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
    {
        if (CharacterSheet.HasOpenDialogs)
        {
            e.Cancel = true;
            Dispatcher.BeginInvoke(new Action(() =>{
                HtmlPage.Window.CurrentBookmark = NavigationService.CurrentSource.ToString().Replace(@"\", @"/");
                CharacterSheet.CloseDialogs();
            }));
        }
        base.OnNavigatingFrom(e);
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文