1.<TextBlock Text="{Binding Message, StringFormat={}{0}元}"/>
2.<TextBlock Text="{Binding Message, StringFormat='yyyy-MM-dd'}"/>
3.<TextBlock Text="{Binding Message, StringFormat='yyyy:MM:dd'}"/>
<pre name="code" class="html">4.<TextBlock Text="{Binding Message, StringFormat='{}{0:D2}'}"/> //1 -》 01
5.多重绑定
<ListBox ItemsSource="{StaticResource MyData}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} -- Now only {1:C}!">
<Binding Path="Description"/>
<Binding Path="Price"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>