views:

149

answers:

1

Hi, I am not sure Why we need to use I ConvertBack method in IValueConverter.

In the Convert method itself we do the conversion and return the updated value to be bound in our control.

So in which Scenario we should use Convertback. I know this question is very basic but just wanted to make the fundamentals clear.

Thanks a lot for your help and suggestions.

Thanks, Subhen

+5  A: 

I don't use it often, but it's my understanding it's for when a binding updates the source value. Wherever your binding updates the source (on the view model usually), and specifies a converter, it will use ConvertBack.

So to give a fabricated example; if your converter added a currency symbol to the start of a double, when a user changed that value your converter would want to remove the symbol again before trying to set the double value on your VM.

Steven Robbins