silverlight - Windows Phone 中的 XAML 字符串格式

标签 silverlight xaml windows-phone-7 windows-phone-8

我如何以给定的格式(7/24/13, 11:24 AM)格式化 DateTime,我找到了一个以类似方式格式化字符串的选项 [Text="{Binding CreatedDate, StringFormat={0:g}}"] , 但我不能在日期和时间之间添加 (",") 逗号。我如何在 Windows 手机中做到这一点。目前使用字符串格式,我得到这样的日期(7/24/13 11:24 AM)。

最佳答案

<TextBlock Text="{Binding Date, StringFormat='{}{0:MM/dd/yyyy, h:mm tt}'}" />

会给你

2013 年 8 月 22 日,上午 11:52

关于silverlight - Windows Phone 中的 XAML 字符串格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18376722/

相关文章:

.net - Silverlight 中的 DataTemplate.DataType 替代方案

wpf - 查找包含隐藏节点和折叠节点的逻辑子节点

c# - 按键排序字典?

web-services - 使用 Web 服务从后台检索应用程序时,如何解决 Windows Phone 8 应用程序中的错误?

c# - 如何获取唯一对象引用作为列表中项目的字符串

c# - Windows Phone Silverlight 8.1 应用程序 - 来自 admob 的 NoFill 答案

silverlight - 哪种背景颜色在 Windows Phone 7 中处于事件状态?

c# - 使用 PdfSharp-WP7 在 wp8 中读取和写入带有一些图像的 pdf 文件

c# - 移动 MainWindow.xaml

c# - View 不会随着 viewModel 的变化而更新