结合日期时间日期在控制

问题描述:

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

我不希望显示在我的控制部分时间。
而不是2010年8月26日上午12:00,我想2010年8月26日。

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 ?

由于3.5 SP1,则可以使用Binding.StringFormat。请参见这个帖子获取更多的例子。

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}}"