Question

Trying to format a datetime bound value in my XAML using Silverlight 5 like so:

<TextBlock Text="{Binding ContactDate, Mode=OneWay, StringFormat={}{0:'dd/MM/yyyy'}}" Margin="5,0" />

I'm getting the following error: Unexpected Token after end of Markup Extension.

This is driving me insane!

Était-ce utile?

La solution

Try: Text="{Binding ContactDate, Mode=OneWay, StringFormat='{}{0:dd/MM/yyyy}'}"

Unless you mean that you want singlequotes before and after the date string.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top