Metro (Windows Store App) DateTime Format in XAML

匆匆过客 提交于 2019-12-01 16:37:18

问题


I haf a DateTime Property. This is Bound to a Textbox with

<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding StartDateString, Mode=TwoWay}" x:Name="date" />

In WPF it was possible to format the DateTime Output with the following syntax

<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding StartDateString, FormatString="dd.mm.yyyy" Mode=TwoWay}" x:Name="date" />

In the Metro Apps (winrt ... Windows Store Apps... how it is called now?), the FormatString property is not possible.

Is there another way to do the format in the xaml file?


回答1:


You're right. There isn't a FormatString parameter in WinRT. You should probably use a value converter. Here's a link to one that should do what you want:

http://blogs.u2u.be/diederik/post/2012/03/19/A-StringFormat-converter-for-Windows-8-Metro.aspx



来源:https://stackoverflow.com/questions/13404247/metro-windows-store-app-datetime-format-in-xaml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!