How to format TimeSpan in XAML

后端 未结 9 2496
一生所求
一生所求 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:23

    The format string is intended to work on a DateTime, not a TimeSpan.

    You could change your code to work with DateTime.Now instead. Your xaml is fine:

    
    

    Update

    And from .Net 4 format a TimeSpan as follows:

    
    

提交回复
热议问题