views:

86

answers:

2

If I have a form with controls DataBound to an instance variable object, is there a way to do revert changes that the user made, possibly by doing something like:

myLocalObject = DataLayer.GetCurrentState();

and have the form's controls (bound to myLocalObject) automatically pick up the changes?

Thanks!

+2  A: 

Take a look into the IEditableObject interface.

HTH, Kent

Kent Boogaart
A: 

I've found that the following does the trick:

var myLocalObject = DataLayer.GetCurrentState();
LayoutRoot.DataContext = null;
LayoutRoot.DataContext = myLocalObject;

For some reason, if I don't set DataContext to null, my bound controls don't pick up the changes when changes are reverted.

Pwninstein