I am trying to write a header-detail form. in VS2010 C# Winforms.
The form binds to an Entity Framework class with an property called Attendees
using a BindingSource
control called bindingSource1
.
The grid is bound to another BindingSource
control with datasource = bindingSource1
and DataMember = Attendees
I am using code first EF. The entity class is
public class ContactEvent
{
public int Id { get; set; }
public string Title { get; set; }
private readonly BindingList<ContactEventAttendee> _attendees = new BindingList<ContactEventAttendee>();
public virtual BindingList<ContactEventAttendee> Attendees
{
get { return _attendees; }
}
}
I set the columns using the designer, deleting all the columns I don't want. As soon as I save the form and re-open it the columns I dont want are back
I have looked here and tried the technique - but it doesn't help. Anyway - my problem shows at design time.
The problem only occurs if I delete all the bound columns. Since all my columns are unbound this is what I want.
The ContactEventAttendee class is as follows;
public class ContactEventAttendee : ILoggedEntity
{
public int Id { get; set; }
public Guid RowId { get; set; }
[ConcurrencyCheck]
public int RowVersionId { get; set; }
public int SourceSiteNumber { get; set; }
public virtual ContactEvent ContactEvent { get; set; }
public virtual Person Person { get; set; }
}
I get the same problem with another related class as well. The problem disappears if I delete the bindingNavigator from the form
The data source is