I am new to .Net but since I have preliminary knowledge of programming I wish to upgrade myself from VB6 to .Net. To start with I downloaded Microsoft's Sample Application "Employee Tracker" and followed the pattern to develop my own small desktop application to keep track of Court cases being carried out in my organisation. I have successfully created all the masters and their views to manage CRUD in WPF using MVVM and Entity Framework. But when it came to handle Many-to-Many relationship I simply got stuck up since the sample application has not covered it. In order to get solution I have tried hard to look around but have not got any solution yet.
I have the following three tables:
1 tblCase (fldCaseId, fldCaseNo)
2 tblParty (fldPartyId, fldName)
3 tblAdvocate (fldAdvocateId, fldName)
And following three tables are the link tables since there is a many-to-many relationship between tblCase-tblParty and tblCase-tblAdvocatefor a single case can have multiple petitioners and a petitioner can exist in multiple cases. Similarly a case can have multipe advocates and an advocate can have multiple cases.
Following are the link tables:
1. tblPetitioner (fldCaseId, fldPartyId)
2. tblRespondent (fldCaseId, fldPartyId)
3. tblEngagedAdvocate(fldCaseId, fldAdvocateId)
Now take a look at the following image:
Look at the two combo boxes located right at the bottom where I have placed a "?" mark. I have assigned two petitioners to the underlying case. And since there are two records in the link table tblPetitioner the viewmodel loads Combo boxes twice.
I have provided an Add Petitioner command to assign new petitioner to the case, which on click loads a new ComboBox to the view. Please note that everytime when a user clicks this command a new Combobox will be loaded to assign new petitioner to the case.
Please tell me the following things:
1. How to set binding path for the itemsource of the combobox to populate the dropdown list with the names available in the table tblParty so that user can select one to assign petitioner to the case.
2.How to set binding path for the selectedItem of the combobox to display name of the petitioner assigned to the case.