我目前正在使用TextBlock以下命令绑定名为的属性的值Name:
<TextBlock Text="{Binding Name}" />
Run Code Online (Sandbox Code Playgroud)
现在,我想绑定另一个名为ID相同的属性TextBlock.
是否可以将两个或多个值绑定到同一个值TextBlock?是否可以通过简单的连接来完成Name + ID,如果没有,可以如何处理它?
视图:
<TextBlock Text="{Binding Date}"/>
Run Code Online (Sandbox Code Playgroud)
我希望将日期格式化为"dd/MM/yyyy",换句话说,没有时间.
我试过了:<TextBlock Text="{Binding Date, StringFormat={}{0:dd/MM/yyyy}}"/>但它不起作用.
给我一个错误:在'Binding'类型中找不到属性'StringFormat'.