我在Visual Studio 2013的设计窗口(WPF应用程序)中遇到无效的标记错误(专业版,更新3)
PhoneSideModule是我添加到页面的用户控件。我尝试使用空的UserControl,但问题仍然存在。
添加UC的页面有x:Class =" WaSAP_Windows.Windows.MainWorker"
不同的命名空间位于同一个项目中,而用户控件不在单独的dll中。
问题是通过以下方式触发的:
xmlns:phone="clr-namespace:WaSAP_Windows.HelperClases"
解决方案是将语句更改为:
xmlns:phone="clr-namespace:WaSAP_Windows.HelperClases;assembly=WaSAP_Windows"
然后标记错误消失,设计器表面正常工作,但随后发生构建错误。
The tag 'PhoneSideModule' does not exist in XML namespace 'clr-namespace:WaSAP_Windows.HelperClases;assembly=WaSAP_Windows'.
将其更改回:
xmlns:phone="clr-namespace:WaSAP_Windows.HelperClases"
然后它构建正常,但无效的标记错误又回来了。 oneSideModule是我添加到页面的用户控件。
为什么会这样?
答案 0 :(得分:0)
请确保您的用户控件包含无参数构造函数(通常情况下调用“InitializeComponent”)。在过去,我只是在现有的无参数用户控件构造函数中添加参数时遇到了这个问题。