views:

168

answers:

1

With .NET 3.5 SP 1 I checked out this blog and followed instructions, however the StringFormat parameter still gets ignored. Any possible reasons? To be sure: the datatype that are involved are DateTime, double, int. So the formatting SHOULD work, but it's not. Any clues why?

EDIT: here's the code!

<Label Content="{Binding Path=TotalHours, StringFormat=Total hours: {}{0:00}}"/>
+3  A: 

Try :

<Label Content="{Binding Path=TotalHours, StringFormat='Total hours: {0:00}'}"/>

{} is necessary only if the format string starts with a {, to escape it, otherwise it'll be recognized as a markup extension. I also like to enclose the StringFormat with simple quotes to avoid problems.

Julien Lebosquain
It works. Thanks a bunch Julien!
John