我们可以在数据绑定中连接两个属性吗? [英] Can we concat two properties in data binding?

查看:22
本文介绍了我们可以在数据绑定中连接两个属性吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在绑定表达式中将两个属性连接在一起吗?如果可能没有转换器或没有编写两个文本块并单独设置它们?

Can we concat two properties together in binding expression? If possible without converter or without writing two textblocks and setting them individually?

推荐答案

就像 alpha-mouse 建议 MultiBinding 不能开箱即用一样,但这个家伙把一些东西放在一起可能会有所帮助:

Like alpha-mouse suggests MultiBinding won't work out of the box, but this guy has thrown something together that might help:

http://www.olsonsoft.com/blogs/stefanolson/post/Improvements-to-Silverlight-Multi-binding-support.aspx

如果这看起来有点无赖,那么也许尝试在您的对象上放置一个组合值属性作为绑定机制的助手,例如:

If that seems a bit rogue, then maybe try putting a combined value property on your object as a helper for the Binding mechanism, like:

public string FullName {
   get { return this.FirstName + " " + this.LastName; }
}

这篇关于我们可以在数据绑定中连接两个属性吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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