Domanda

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!

È stato utile?

Soluzione

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

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top