Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does ConvertBack method get called?

I know that when data is about to be displayed, Convert() method is called to convert the data and the converted data is displayed instead.

I'm wondering when ConvertBack() method gets called? What is its purpose?

I've a DataGrid whose ItemSource is binded to some collection, and I've implemented IValueConverter for one property of items in the collection. When I make IsReadOnly="True" (in the DataGrid), then ConvertBack method is called if I double-click on the cell (for which IValueConverter is implemented) and then change the focus. But when I make IsReadOnly="False", then ConvertBack method is never called, no matter what I do with the DataGrid and its cells.

Please explain this behavior of DataGrid cells and ConvertBack method of IValueConverter.

like image 658
Nawaz Avatar asked Mar 23 '11 09:03

Nawaz


1 Answers

"The data binding engine calls this method when it propagates a value from the binding target to the binding source."

see msdn

you should post your binding for your cell with the valueconverter

like image 74
blindmeis Avatar answered Sep 28 '22 23:09

blindmeis