Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法在组合框上格式化Timespan_C#_Wpf - Fatal编程技术网

C# 无法在组合框上格式化Timespan

C# 无法在组合框上格式化Timespan,c#,wpf,C#,Wpf,我有一个组合框,其中项目资源是列表。我试图设置ItemStringFormat属性,以便将时间格式化为“13:25”,而不是“13:25:00”,但是,我得到的只是空项 我试过了 <ComboBox ItemsSource="{Binding MyCollection}" ItemStringFormat="hh\\:mm"/> 这是您正在寻找的格式: <ComboBox ItemsSource="{Binding MyCollection}" ItemS

我有一个
组合框
,其中
项目资源
列表
。我试图设置
ItemStringFormat
属性,以便将时间格式化为“13:25”,而不是“13:25:00”,但是,我得到的只是空项

我试过了

<ComboBox ItemsSource="{Binding MyCollection}" ItemStringFormat="hh\\:mm"/>

这是您正在寻找的格式:

<ComboBox ItemsSource="{Binding MyCollection}"
          ItemStringFormat="{}{0:hh}:{0:mm}" />

这是您正在寻找的格式:

<ComboBox ItemsSource="{Binding MyCollection}"
          ItemStringFormat="{}{0:hh}:{0:mm}" />