I have a WPF application consuming data using Entity Framework 4 and Self-Tracking Entities. In which I have a window with 2 controls in it, one that shows the "Details" portion of an object using a ContentControl and templates from a merged resource dictionary. Another with a ListBox of Groups the object in question belongs to and a ComboBox of available groups it could belong towith a button wired up via a command to the control to add/remove items from the bound collection of Groups based on the SelectedItem of the ComboBox. All this is bound together by DependencyPropertys.
In my Window I have DP's for the Object, EditedItem we are editing and a read only property with a List of Group of the groups it could belong to and bind that to my controls via XAML.
SO....
If I create a new instance of one of my entities, set it's properties like so: (Really this is the exact code)
Employee employee = Context.CreateObject<Employee>();
employee.Name = "Joe Nobody's Brother Steve";
employee.Active = true;
employee.Username = "snobody";
Group group = Context.CreateObject<Group>();
group.Name = "Losers";
group.DisplayName = "Spirit Squad";
employee.Groups.Add(group);
And set it as my Window's EditedItem it works FLAWLESSLY!
If I however fetch this exact same entity from my Database the Groups ListBox is empty. Any ideas?