WPF XAML之bing使用StringFormat

WPF XAML之bing使用StringFormat 

// 转化为百分比

 Text="{Binding Progress, StringFormat={0:P}}"

<TextBlock FontSize="22" Text="{Binding Score, StringFormat={}{0:f1}}" Margin="0,-3,0,0"
                                           Foreground="#FFFE711C" VerticalAlignment="Center" HorizontalAlignment="Right"/>

<TextBlock Text="{Binding Date, StringFormat={}{0:MM/dd/yyyy}}" />

 或者

<TextBlock Text="{Binding Time,StringFormat='yyyy:MM:dd HH:mm:ss'}"/>
原文地址:https://www.cnblogs.com/m7777/p/4860288.html