I have a Silverlight 4 application for a simple "TODO" list. The problem I am facing is that the data binding binds relationships with my TODO object, which causes the RIA data context to add it to the DataContext.TODOs list before I want it there. I want to treat the object as new and disconnected until I explicitly add it to the datacontext.
Here's how it works: I have a TODO object that is associated with a Status (RIA service object relation).
I create a new TODO() object that is passed to the ChildWindow . Please note that I am not adding this new object to my datacontext.
new CreateTODOPopup(new TODO()).Show();
In the DataForm in my ChildWindow, I have a combo box for Status that binds to DataContext.Statuses .
The problem is that the action of selecting Status from the drop-down list actually associates the entity with the context for me - ending up giving it EntityState.New status and actually adding it to the DataContext.TODOs collection.
That would be nice, except that now it appears in the main TODO list in the main frame. I do not want this because it has not yet been captured by ChildWindow.
How can i solve this? Either by hindering the attachment of an object, or by hiding it in some way from any controls, it is tied until it is added.
source share