Warm tip: This article is reproduced from serverfault.com, please click

c#-Silverlight 中的 XAML 格式日期/时间

(c# - Format Date/Time in XAML in Silverlight)

发布于 2011-04-07 17:14:17

我有一个 Silverlight 4 应用程序。我有一个 C# DateTime 对象,我绑定到我的 UI。我希望此日期dd/mm/yyyy时间采用时间格式(TimeZone)。例如,今天将显示为

04/07/2011 at 01:13 p.m. (EST)

有没有办法做到这一点XAML还是我需要建立一个转换器?

Questioner
user687554
Viewed
0
Vlad Bezden 2013-08-21 00:26:41
<TextBlock Text="{Binding Date, StringFormat='{}{0:MM/dd/yyyy a\\t h:mm tt}'}" />

会回报你

2011 年 4 月 7 日下午 1:28 (-04)