【问题标题】:windows 8 metro navigation issuewindows 8 地铁导航问题
【发布时间】:2012-06-10 17:52:58
【问题描述】:

如何在 Windows 8 Metro 风格 xaml C# 应用程序中从用户控件导航到页面。

更新: 实际上这个用户控件在另一个用户控件中。下面的代码在用户控件中使用时可以正常工作,但在嵌套用户控件中则不起作用。

这是我当前不起作用的代码。

        var cntnt = Window.Current.Content;
        var frame = cntnt as Frame;

        if (frame != null)
        { 
            frame.Navigate(typeof(MyPage1), null);
        }
        Window.Current.Activate();

它不会导航到 MyPage1 ,但也不例外。

谢谢

【问题讨论】:

  • 地铁“吃掉”了许多例外。尝试打开“抛出异常时中断”进行调试。例如,您可能在 MyPage1 的 OnNaviagtedTo 方法中遇到问题。

标签: c# xaml windows-8 windows-runtime winrt-xaml


【解决方案1】:

您不应将 null 作为参数传递。试着打电话

frame.Navigate(typeof(MyPage1));

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2015-02-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多