1

I have this StringFormat StringFormat={}{0:#,0}} that represent decimal numbers and I want add text of my own after this number.

This is what I have tried (but it does not compile with the text inside the StringFormat)

Content="{Binding Path=(my:MyClass.MyStaticProperty),StringFormat={}{0:#,0}} My Text"

my:MyClass.MyStaticProperty is integer type.
Harry
  • 87,580
  • 25
  • 202
  • 214
user979033
  • 5,430
  • 7
  • 32
  • 50

1 Answers1

0

As you use Label, Content cannot be formatted with StringFormat. Please view this topic.

Your solution is to use ContentStringFormat:

<Label Content="{Binding Source={x:Static my:MyClass.MyStaticProperty}}"
       ContentStringFormat="{}{0:#.0} My Text"/>
Community
  • 1
  • 1
keymusicman
  • 1,281
  • 1
  • 10
  • 20