标签StringFormat不起作用 [英] Label StringFormat doesn't work
本文介绍了标签StringFormat不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用stringFormat格式化{datetime?}属性,但是我不知道为什么它不适用于该属性。
I am trying to format a {datetime?} property with stringFormat, but I don't know why it doesn't applied to.
这是我的代码
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Label Content="{Binding From, StringFormat='{}{0:dd.MM.yyyy}'}"/>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
我做错了吗?
推荐答案
将标签内容放入TextBlock
Put the contents of the label into a TextBlock
<Label>
<TextBlock Text="{Binding Path=From, StringFormat='{}{0:dd.MM.yyyy}'}"/>
</Label>
这篇关于标签StringFormat不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文