I haf a DateTime Property.这绑定到带有
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding StartDateString, Mode=TwoWay}" x:Name="date" />
在 WPF 中,可以使用以下语法设置日期时间输出的格式
<TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding StartDateString, FormatString="dd.mm.yyyy" Mode=TwoWay}" x:Name="date" />
在地铁应用程序中(Winrt ...视窗应用商店应用...现在如何调用?),FormatString 属性是不可能的。
有没有另一种方法可以在 xaml 文件中进行格式化?
你是对的。 WinRT 中没有FormatString
参数。 您可能应该使用值转换器。 这是一个应该做你想做的事的链接:
http://blogs.u2u.be/diederik/post/2012/03/19/A-StringFormat-converter-for-Windows-8-Metro.aspx