WPF binding StringFormat syntax

前端 未结 1 1232
名媛妹妹
名媛妹妹 2020-12-10 02:21

How can I format a decimal value conditionally in a WPF window?

  1. Value should be rounded to a whole number (Ex: 1,234)
  2. When the value is 0.00, it shoul
相关标签:
1条回答
  • 2020-12-10 02:58

    The extra 0 comes from the 0 after the colon.

    Instead, try {}{0:#,0}.

    From the MSDN docs on Custom Numeric String formats (emphasis added):

    "0" | Zero placeholder | Replaces the zero with the corresponding digit if one is present; otherwise, zero appears in the result string.

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