WPF Xaml StringFormat

3

Good afternoon guys, I have a somewhat ridiculous problem, but I can not find the solution.

I'm trying some stringFormat as StringFormat={}{0:#,#.00}} and StringFormat=N2} , in addition to StringFormat='c' , but taking the first one that does not compile (I do not know why) the others enter 2 decimal places (value + 00) but I'd like him to consider the last two houses of value as the pennies.

<DataGridTextColumn Header="Valor Fator" Binding="{Binding 
PendenciaValorFator, Mode=TwoWay, StringFormat=N2, 
UpdateSourceTrigger=PropertyChanged}" IsReadOnly="False">

I am sending a decimal with this format: 728001 and it is showing 728.001, but I would like it to display 7,280.01.

Adding, I need to be sent a numeric value for the grid otherwise when I make the "order" it will do so by string, first placing the value 1,111.11 instead of 999.99.

    
asked by anonymous 22.11.2016 / 19:24

1 answer

1

In order for the resulting string to have decimal places as desired, the source value, in this case PendenciaValorFator , must represent this value with those decimal places.

That is, for the result to be "7280.01" it is necessary that PendenciaValorFator is equal to 7280.01 and not 728001 .

    
22.11.2016 / 22:57