Lucifer
Lucifer

Reputation: 2347

WPF Binding StringFormat

I'm trying to format a textblock bound to an integer. What I want is to show (+25) for positive number and (-25) for a negative one. So far i have been able to do it separately with the following xaml:

  StringFormat={}({0})}  // shows binding in a bracket
  StringFormat=+#;-#;0   // shows the sign

What would the xaml for the combined formatting be ?

Upvotes: 0

Views: 1280

Answers (1)

Florian Gl
Florian Gl

Reputation: 6014

StringFormat="({0:+#;-#;0})" did work for me.

Upvotes: 1

Related Questions