tags:

views:

17

answers:

1
<TextBox Text="{Binding Path=Double, StringFormat=F3}"/>

StringFormat in the below statement is hard coded. But it will change according to the culture and Customized settings. How can we se the rounding or String format using Dependency property or normal property? This can be applied to TextBox, Label , TextBlock etc where ever we wish to use the String formatting.

+1  A: 

No, you can't bind StringFormat, since it's not a dependency property. When you doing something more serious than basic formatting consider two options:

Option 1. Make your ViewModel (i.e. binding source) return data in a most convenient way.

Option 2. Consider using custom value converters.

Anvaka