我有一个 DateTime 属性。
这是绑定到文本框的
<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" />
在 Metro Apps(winrt ... Windows Store Apps...现在怎么称呼?)中,FormatString 属性是不可能的。
还有其他方法可以在 xaml 文件中进行格式化吗?
你说得对。没有一个FormatString
WinRT 中的参数。您可能应该使用值转换器。这是一个应该可以完成您想要的操作的链接:
http://blogs.u2u.be/diederik/post/2012/03/19/A-StringFormat-converter-for-Windows-8-Metro.aspx
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)