小编Roo*_*omm的帖子

如何在wpf(DataGrid)中格式化TimeSpan?

我将 TimeSpan 以刻度为单位保存到 SqlCe 中,当我将数据加载到 DataGrid 中时,我想以 HH:MM:SS 格式设置该值。我用这个试试:

<DataGridTextColumn Binding="{Binding tiempo, StringFormat={}{0:hh':'mm':'ss}, TargetNullValue=' --- '}"  Width="80" Header="Tiempo"/>
Run Code Online (Sandbox Code Playgroud)

但 DataGrid 显示“hh:mm:ss”而不是值。

我也尝试尝试其他模式,例如 StringFormat="hh\:mm\:ss"

任何想法?

谢谢!抱歉我的英语不好!

c# format wpf datagrid timestamp

3
推荐指数
1
解决办法
4487
查看次数

标签 统计

c# ×1

datagrid ×1

format ×1

timestamp ×1

wpf ×1