Windows Phone中的时间选择器格式

本文关键字:选择器 格式 时间 Phone Windows | 更新日期: 2023-09-27 17:58:44

我在XAML代码中有

<toolkit:TimePicker ValueStringFormat="{}{0:H:m:ss}" Foreground="Black" BorderBrush="Black"/>

我想选择"小时、分钟、秒"格式的时间,但现在我可以选择"上午6.22"这样的时间。我该怎么做?

Windows Phone中的时间选择器格式

ShortTimePattern(又名"6:22AM")的默认值为{}{0:t}。要轻松添加秒数,只需将同一字符串中的"T"大写即可使其成为LongTimePattern,这会使您获得类似{}{0:T}的效果;

ValueStringFormat="{}{0:T}"

你完成了,很好,很容易。。。

希望这能有所帮助,干杯。

AM/PM指示符为"tt"

A/p的空头是"t"

参见

<toolkit:TimePicker ValueStringFormat="{}{0:h:m:ss tt}" Foreground="Black" BorderBrush="Black"/>

或者没有秒:

<toolkit:TimePicker ValueStringFormat="{}{0:h:m tt}" Foreground="Black" BorderBrush="Black"/>