Format date with StringFormat in TextBlock in WPF
问题 I have stored date in database without slashing for some reason . it means that I have a date field like 20110602. As i want to retrieve this date and show it in a textblock I need a formatting to show this date as a normal date with slash. How can i use StringFormat in this way ? ... does anyone konw what format should I use to convert "20110602" to 2011/06/02 ? <TextBlock Text="{Binding CreatedDate, StringFormat=?????" 回答1: If you perfer the route of implementing a converter: class