WPF 设计器永远无法正确加载 [英] WPF Designer Never Loads Properly

查看:71
本文介绍了WPF 设计器永远无法正确加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 WPF 应用程序,除了一个例外,一切似乎都运行良好 - 设计器很少(如果有的话)正确加载.通常抱怨 Undefined CLR namespace. 然后说它找不到我的一些 local: 定义的控件.

I have an WPF app, all seems to run fine with one exception - the designer rarely, if ever, loads correctly. Usually complaining about Undefined CLR namespace. and then saying it can't find a few of my local: defined controls.

这只是设计器或 Visual Studios 代码生成中的缺陷,还是我的应用程序存在系统性问题?

Is this just a defect in the designer or Visual Studios code generation or actually systemic of something wrong with my application?

推荐答案

在您的代码中可能出现仅在设计时发生的错误.可以调试它.请参阅如何:调试设计器加载失败.很快,您需要另一个 Visual Studio 实例并将其附加到显示您的 wpf 应用程序的实例.您甚至可以尝试使用 How to: Debug .NET Framework 跟踪错误的根源来源.

In your code can be an error which occurs only in design time. It is possible to debug it. See How to: Debug a Designer Load Failure. Shortly you need another instance of Visual Studio and attach it to the one displaying your wpf app. You can even try to follow the error to its roots with How to: Debug .NET Framework Source.

我遇到了类似的问题,我成功地将其追踪到 DataContextChanged 事件处理程序并摆脱了它.

I had a similar problem and I successfully tracked it down to DataContextChanged event handler and got rid of it.

这篇关于WPF 设计器永远无法正确加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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