在类型中找不到属性 [英] Property not found in type

查看:103
本文介绍了在类型中找不到属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<TextBox binding="{Binding FirstName}" canvas.left="93" canvas.top="8" height="23" x:name="_arFirstName" width="120" isreadonly="True" xmlns:x="#unknown" /> 


上面是一段XAML代码,我在其中添加了绑定"到仅存在于我的域对象中的属性".顺便说一句,它说文本框"为绑定",并显示一条错误消息:在文本框"类型中找不到属性绑定".我缺少什么才能在C#代码中引用域对象属性?

谢谢.

*注意*并非我所有的代码段都已转移财产.第一部分确实表明它是一个TextBox


The above is a piece of XAML code to which I added Binding to a Property which exists only in my domain object. Incidentally where it says Textbox "Binding" and getting an error that says: The property Binding was not found in type ''TextBox''. What am I missing to get this to refer to my domain object property in my C# code?

Thanks.

*Note* Not all of my snippet was transferred property. The first part does indicate that it is a TextBox

推荐答案

在您的Window的构造函数或Load 事件中,您需要设置数据上下文到您的业务对象.

In your Window''s constructor or Load event, you need to set the data-context to your business-object.

this.DataContext = yourBusinessObject;



并且假定yourBusinessObject 中将具有FirstName 属性.



And it''s assumed that yourBusinessObject will have the FirstName property in it.


这篇关于在类型中找不到属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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