Silverlight 3:没有变化,但是现在我得到“找不到页面" [英] Silverlight 3: No change but now I am getting "Page Not Found"

查看:81
本文介绍了Silverlight 3:没有变化,但是现在我得到“找不到页面"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

页面运行正常.我所做的唯一更改是在页面上添加了一个数据网格(它也添加了xmlns),突然间我发现页面未找到.检查了UriMappings.尝试了默认的导航链接.没事.

Had a page that was working fine. Only change I made was to add a datagrid to the page (which also added the xmlns) and all of the sudden I'm getting Page Not Found. Checked the UriMappings. Tried the default nav link. No joy.

想法?

更新:答案是我有一个没有初始化集合的模拟类.有关节省时间的方法,请参见Byrant的答案.

UPDATE: The answer was that I had a mock class that was not initializing a collection. See Byrant's answer for a way to save yourself some time.

推荐答案

要查看问题所在,您需要对MainPage.xaml.cs进行一次更改:

To see what the issue is you need to make one change to your MainPage.xaml.cs:

// If an error occurs during navigation, show an error window
private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
    Exception ex = e.Exception;

    while (ex.InnerException != null)
    {
        ex = ex.InnerException;
    }

    e.Handled = true;
    ChildWindow errorWin = new ErrorWindow(ex);
    errorWin.Show();
}

启动应用程序后,一旦进行了更改,您应该会看到异常,而不是出现异常的页面.

Once you've made that change when you start the application you should see the exception instead of the page where the exception occurred.

这篇关于Silverlight 3:没有变化,但是现在我得到“找不到页面"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆