2 data-binding silverlight xaml concatenation append
我有一个控件接受一个字符串,但在显示它时,我想在xaml中将"Hello"追加到该字符串,我该怎么做?
您可以绑定到该属性并使用StringFormat:
<TextBlock Text=”{Binding Path=UserName, StringFormat=’Hello \{0\} ’}“/>
Run Code Online (Sandbox Code Playgroud)
更多信息可以在这里找到:http: //www.designersilverlight.com/2010/05/28/silverlight-4-binding-and-stringformat-in-xaml/