views:

233

answers:

1

I have a Silverlight master-details DataForm where the DataForm represents a street address.

When I edit the Address1 textbox, the value gets automatically committed to the bound Address object once focus leaves the textbox.

If I hit the Cancel button, then any changes are undone because Address implements IEditableObject and saves its state.

The problem is that since any change is immediately propagated to the underlying object it will be shown in the master grid before the user has actually hit Save. I also have other locations where this data is shown. This is not a very good user experience.

I've tried OneWay binding but then I can't commit back without manually copying all the fields over.

The only thing I can think of doing is to create a copy of the data first or using OneWay binding, but they both seem a little clumsy.

Does DataForm support this way of working?

+1  A: 

The copy of the object feels a little clumsy, but I would use that: it's coming back into style with systems like ASP.NET MVC.

You then also have a good opportunity to do any level of validation you want before commiting it to what will be propagated to other bound controls.

Jeff Wilcox
i was hoping i was missing something :-( this seems to be the safest way overall
Simon_Weaver
and of course this isn't just a DataForm problem. making a copy of the object helps solve this problem for plain old textboxes for instance. its just that with the way that DataForm works being intelligent about interfaces such as IEditableObject i was hoping there was a way to get this to work because it would help me out in certain cases
Simon_Weaver