Navigation is only supported to relative URIs that are fragments, or begin with '/', or which contain ';component/'. Parameter name: uri

突然遇到这烦恼的问题,由于心情不好,导致处理了好久。

 

解决办法:

1.从简单的路径检查: /page1.xaml, .../page.xaml

2.从程序集检查:

var nameHelper = new AssemblyName(Assembly.GetExecutingAssembly().FullName);

 

            var version = nameHelper.Version;

            var full = nameHelper.FullName;

            var name = nameHelper.Name;

 

3.从URLmap检查:

      <navigation:UriMapper x:Key="UriMapper">

            <navigation:UriMapper.UriMappings>

                <navigation:UriMapping Uri="" MappedUri="/MainPage.xaml"/>

                <navigation:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>

                <navigation:UriMapping Uri="/{pageName}/{key}" 

                                   MappedUri="/Views/{pageName}.xaml?entityGuid={key}"/>

            </navigation:UriMapper.UriMappings>

        </navigation:UriMapper>

        

 

真正解决:

在异常退出发现:

   private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
        {
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // A navigation has failed; break into the debugger
                System.Diagnostics.Debugger.Break();
            }
        }

 

其中的naveigationFailedEventArgs e的e显示 no xaml in view/setting.

说明我设置了Url map,但没有写好导航的格式。

至此问题解决。

posted on 2012-04-21 11:28  SUNJUNLIN  阅读(407)  评论(0编辑  收藏  举报

导航