且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WPF XAML中的日期字符串格式

更新时间:2022-11-11 16:55:27

请尝试以下操作:

<TextBlock Text="{Binding Start, StringFormat=d}" />

这需要.NET 3.5 SP1或更高版本。

This requires .NET 3.5 SP1 or above.

Btw .: StringFormat区分大小写。 d是短日期格式说明符,而D是长日期格式说明符

Btw.: StringFormat is case sensitive. "d" is the short date format specifier while "D" is the long date format specifier.