将两个属性绑定到==>单控制
假设我有属性
FIrstName
和 LastName
我需要将其与单个 textbox
绑定。
因此,在单个文本框中,我可以显示两者FirstName
和LastName
。
那怎么可能呢?
Suppose I have property
FIrstName
and LastName
I need to bound it with single textbox
.
So in just single textbox I can display both FirstName
and LastName
.
Then how could it be possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用多重绑定来做到这一点
对于 OnWay 绑定,请使用此:
有关 MutiBinding 类的更多信息,请参阅 此处
You can use multibinding to do that
For OnWay Binding use this:
For more information about MutiBinding Class look at here
尝试 MultiBinding 类:
Try the MultiBinding Class :
也许是第三个属性
FullName
。为了获得更好的帮助,请提出更好的问题(例如,您的类型是什么)。
编辑:无论如何,我建议至少有两个文本框,这样你就可以安全地处理“多部分名称”,就像上面提到的Karl Heinz Schmidt-Meyer von Neuenhausen zu Bad-Reichenhall。除了不太含糊之外,这是网络表单事实上的标准。
edit2:作为关于 Navid Rahmani 答案的注释,因为它可能会导致真正严重的数据库损坏、系统管理员和程序员的加班成本,他们将没有起点和线索来了解应用程序失败的原因,以及大量的问题 钱。也就是说,如果在您的客户已经失去其客户之前发现这种令人毛骨悚然的腐败行为。
有问题的代码
我的问题是它将如何处理多部分名称。他回答说可以用“,”。我的回复:
A third property
FullName
, perhaps.For better help, please ask a better question (what are your types, e.g.).
edit: Anyways, I'd recommend to have at least two textboxes, so you can safely handle "multipart names", like the above mentioned
Karl Heinz Schmidt-Meyer von Neuenhausen zu Bad-Reichenhall
. Apart from being less ambiguous, this is a defacto standard on web-forms.edit2: As a note about Navid Rahmani answer, because it opens up the potential for really severe database corruption, costs overtime for sys-admins, the programmers, who'll have no starting point and clue for why their application fails, and tons of money. That is, if this creepy corruption is ever discovered before your client has already lost its clients.
Code in question
My question was how it would handle multipart names. He answered one could use "," then. My reply:
像这样的事情应该会让你接近。这不是用 VS 编写的,所以我不确定它的语法是否正确。
Something like this should get you close. This was not written in VS so I'm not sure if it's syntactically correct.