WPF Textbox loses original values, even if the user doesn't udpate

Oct 6 2010 5:04 PM
Hi,

I am having a very strange issue. I have a datagrid which is binding to an observable collection of type Person The selected item is bind to an Object Person. I have 2 textboxes firstname and lastname. When ever user selects an item from grid, the textbox values gets populated. user can edit the values and click submit button, values gets updated.

Source to Target works correctly - i.e. able to display from viewModel When I update the values gets updated.

Lets say user selected an item with firstname john, lastname smith The problem is user edits the firstname to johnny and he doesn't click submit button instead he selects a different item from datagrid, so when I go back to the original selected item. In the grid the selected item is shown as John smith, but in the textbox the value is shown as Johnny smith.

How to solve this problem? Any help would be greatly appreciated.

Answers (1)