Kubi
Kubi

Reputation: 2169

Binding Date of DateTime in a control

Text="{Binding Path=PostDate.Date}"

I don't want to show the time part in my control. Instead of 8/26/2010 12:00 AM, I want 8/26/2010.

Is there any easy way to do that without any explicit/implicit conversion or overriding some methods ?

Upvotes: 2

Views: 920

Answers (1)

Bubblewrap
Bubblewrap

Reputation: 7516

Since 3.5 SP1, you can use Binding.StringFormat. See this post for more examples

Text="{Binding Path=PostData.Data, StringFormat={}{0:MM/dd/yyyy}}"

Upvotes: 3

Related Questions