Customizing the Value Format
The format of the DateTime
value can be specified by setting the DatePicker
or TimePicker ValueStringFormat
property. For example, to present the DateTime
value of a TimePicker
using a long time format, the ValueStringFormat
is set to {0:T}. Because curly brackets are treated as special characters in XAML, they must be escaped. This is done by prefixing {} to the format string, as shown in the following excerpt:
<toolkit:TimePicker x:Name="timePicker" Value="{Binding Time, Mode=TwoWay}" Header="time with custom format" ValueStringFormat="{}{0:T}"/>
Alternatively, to set the format in the code-beside, you could use the following: ...
Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.