I know that WPF 3.5 SP1 supports a StringFormat in a binding, but can Silverlight do the same? I thought it could, but damned if I can make it work!
Here’s a snippet of my XAML:
<TextBlock Text='{Binding StartTime, StringFormat=t}' />
It compiles OK, but I get a runtime error when it gets to the browser…
Silverlight 3 and below do not, but you can use a Value Converter and specify the ConverterParamenter in the binding. You’ll have to create your own Value Converter by deriving a class from IValueConverter like I’ve shown here.
Silverlight 4 and later has the same StringFormat binding property as WPF.