How to format TimeSpan in XAML

后端 未结 9 2485
一生所求
一生所求 2020-11-30 00:43

I am trying to format a textblock which is bound to a TimeSpan property. It works if the property is of type DateTime but it fails if it is a

9条回答
  •  一生所求
    2020-11-30 01:45

    StringFormat must be in the form of a format string. In this case it would look like:

    
    

    Note: if you want to display the total number of hours and minutes and the timespan happens to be greater than 24 hours, there's a caveat with your approach: Here's a workaround.

提交回复
热议问题