WPF-数据绑定:日期时间格式
代码:
<ListView Name="listview1" Width="auto"> <ListView.View> <GridView x:Name="gridView1"> <GridViewColumn Header="CityID" DisplayMemberBinding="{Binding Path=CityID}"/> <GridViewColumn Header="CityName" DisplayMemberBinding="{Binding Path=CityName}"/> <GridViewColumn Header="ZipCode" DisplayMemberBinding="{Binding Path=ZipCode}"/> <GridViewColumn Header="ProvinceID" DisplayMemberBinding="{Binding Path=ProvinceID}"/> <GridViewColumn Header="DateCreated" DisplayMemberBinding="{Binding Path=DateCreated,StringFormat='{}{0:yyyy年MM月dd日 dddd HH:mm:ss}',ConverterCulture=zh-CN}"/> <GridViewColumn Header="DateUpdated" DisplayMemberBinding="{Binding Path=DateUpdated,StringFormat='{}{0:yyyy年MM月dd日 dddd HH:mm:ss}',ConverterCulture=zh-CN}"/> </GridView> </ListView.View> </ListView>
StringFormat='{}{0:yyyy年MM月dd日 dddd HH:mm:ss}',ConverterCulture=zh-CN}
StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}
效果图: