简体   繁体   English

不能使用用户控件

[英]can't use a user control

I've just added a user control to a windows phone project, but I can't use it. 我刚刚将用户控件添加到Windows Phone项目中,但无法使用。 what I did after creating the control ( the old fashion way: click add --> UserControl, named it RecordList and added a text block and a button in canvas. Simple), I added the namespace in the MainPage of my project like this: xmlns:local="clr-namespace:Project1" and in the Content Panel I added the control like this: . 创建控件后所做的事情(旧的方式:单击添加-> UserControl,将其命名为RecordList并在画布中添加了一个文本块和一个按钮。很简单),我在项目的MainPage中添加了命名空间,如下所示: xmlns:local =“ clr-namespace:Project1”,然后在内容面板中添加如下控件:。 But it gives me an error :The type 'local:RecordList' was not found. 但这给了我一个错误:找不到'local:RecordList'类型。 Verify that you are not missing an assembly reference and that all referenced assemblies have been built. 验证您没有丢失程序集引用,并且所有引用的程序集均已构建。 I picked this method from this link 我从此链接中选择了此方法

PS: I am a beginner in the software development. PS:我是软件开发的初学者。

Try adding the assembly in the namespace declaration attribute 尝试在名称空间声明属性中添加程序集

"xmlns:local="clr-namespace:Project1;assembly=%Name of the Assembly%" ie (Presentation.Infrastructure) where Presentation is the project name, and Infrastructure is the folder where the control lives. – –“ xmlns:local =“ clr-namespace:Project1; assembly =%程序集名称%”,即(Presentation.Infrastructure),其中Presentation是项目名称,而Infrastructure是控件所在的文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM