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}" />