Pregunta

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!

¿Fue útil?

Solución

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

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top