Binding Navigation Property with Entity Framework

Posted by JSmaga on Stack Overflow See other posts from Stack Overflow or by JSmaga
Published on 2011-03-03T15:22:49Z Indexed on 2011/03/03 15:24 UTC
Read the original article Hit count: 223

Filed under:
|
|

Hi,

I have another question about binding using C# and the entity framework.

Here, I'm looking to bind a navigation property to a listbox or a listview.

I saw on different posts that if I update the collection using code behind the list would not be notified because the collection does not handle notification (it's always the same problem anyway).

People suggested to use an ObservableCollection for example, but, and here is my question, this comes down to basically duplicate the collection and hence, if I modify it, I'd have to handle in code-behind the fact that the change has also to be applied to the "original" navigation property right?

If that's the case, I was thinking: why not create a custom property called, say, MyObservableNavigationProperty in a partial class. I could then interact only with this collection, catch the event when the collection is changed and apply the change to the "original" collection. Is that a nice way to do the trick? or am I getting all confused here....

© Stack Overflow or respective owner

Related posts about c#

Related posts about binding