在 Silverlight 中以 XAML 格式格式化日期/时间 [英] Format Date/Time in XAML in Silverlight
本文介绍了在 Silverlight 中以 XAML 格式格式化日期/时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 Silverlight 4 应用程序.我有一个 C# DateTime 对象,我绑定到我的 UI.我希望此日期时间采用 dd/mm/yyyy
时间(时区)的格式.例如,今天将显示为
I have a Silverlight 4 application. I have a C# DateTime object that I'm binding to my UI. I want this DateTime to be in the format of dd/mm/yyyy
time (TimeZone). For instance, today would be displayed as
04/07/2011 at 01:13 p.m. (EST)
有没有办法做到这一点XAML
?还是我需要构建一个转换器?
Is there a way to do this XAML
? Or do I need to build a converter?
推荐答案
<TextBlock Text="{Binding Date, StringFormat='{}{0:MM/dd/yyyy a\t h:mm tt}'}" />
会回报你
04/07/2011 下午 1:28 (-04)
04/07/2011 at 1:28 PM (-04)
这篇关于在 Silverlight 中以 XAML 格式格式化日期/时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文