It seems that, like Binding in WinRT, Binding in Windows Phone Universal Apps does not have the StringFormat property. One possible way around this limitation is to use Converter , as described in this blog post ,
To summarize the message, you can create an IValueConverter implantation that takes a string format as a parameter:
public sealed class StringFormatConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { if (value == null) return null; if (parameter == null) return value; return string.Format((string)parameter, value); } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } }
Create the resource of the above converter in your XAML, then you can use it, for example, as follows:
<TextBlock x:Name="countTextBlock" Text="{Binding Count, Converter={StaticResource StringFormatConverter}, ConverterParameter='{}{0:n}'}" />
source share