标签:style blog http ar color 使用 sp for on
TextBlock 的 Text 可以绑定多个数据源,配合 StringFormat 就可以很方便地显示了。
1 <TextBlock Text="{Binding Text,StringFormat=Name:{0}}"/> 2 <TextBlock FontSize="30" TextWrapping="Wrap"> 3 <TextBlock.Text> 4 <MultiBinding StringFormat="Name:
 {0}

Age:
 {1}

Grade:
 {2}"> 5 <Binding Path="Name"/> 6 <Binding Path="Age"/> 7 <Binding Path="Grade"/> 8 </MultiBinding> 9 </TextBlock.Text> 10 </TextBlock>
\a  BEL
\b  BS - Backspace
\f  FF - Formfeed
\n 
 LF, NL - Linefeed, New Line
\r 
 CR - Carriage return
\t 	 HT - Tab, Horizontal Tabelator
\v  VT - Vertical Tabelator
如果同时设置 Converter 和 StringFormat 属性,则会先对数据值应用转换器,然后再应用 StringFormat。
本文参考:http://www.cnblogs.com/xiwang/archive/2013/05/26/3100009.html
标签:style blog http ar color 使用 sp for on
原文地址:http://www.cnblogs.com/pengzhong/p/WPFBindingStringFormat.html