Format number with + and - sign

前端 未结 1 721
情歌与酒
情歌与酒 2021-01-06 02:59

I have some WPF textblocks in a stackpanel that I want to databind and format.

E.g. the following formats a date 24h style without the seconds part:

         


        
相关标签:
1条回答
  • 2021-01-06 03:18

    Try this:

    <TextBlock Text="{Binding MyOtherCustomObject, StringFormat={}{0:+#;-#;''}}" />
    

    This article has nice samples of int formatting - http://www.csharp-examples.net/string-format-int/

    0 讨论(0)
提交回复
热议问题