PatFromCanada
PatFromCanada

Reputation: 2788

format string for databinding, thousands separator and brackets without Currency sign

I want to databind a grid column in WPF so that the value looks like this for negative numbers

(1,234.00)

I can do Binding="{Binding Path=ContractBTM.BasisAmount,StringFormat={}{0:0.00;(0.00)}}" but that does not give me the separator.

I can do StringFormat=N but the negative values use the minus sign.

I tried using the #,### syntax but it doesn't like the comma in my binding string.

OK I ended up going with StringFormat={}{0:#,##0.00;(#,##0.00)} and ignoring the errors

Upvotes: 1

Views: 1902

Answers (1)

Walt Ritscher
Walt Ritscher

Reputation: 7047

<TextBlock Text="{Binding Path=ContractBTM.BasisAmount, StringFormat={}{0:0.00;(0,000.00)}}" />

Upvotes: 1

Related Questions