I have a Silverlight 3 project. I have a textbox that is TwoWay data bound to an object. If the user wants to cancel the changes that they made to the textbox, what is the best way to undo the changes to the bound field on the object?
I know I could store the initial value in a separte variable when the object is loaded, but I was wondering if there was a better way of doing this?
Thanks.
If you want to roll back when the value is set, then throw an exception in the property setter.
If you need to do rollback on submit, then you should store the settings in a separate class and provide atomic setting and rollback – make sure that each of your properties support INotifyPropertyChanged.