Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF DataContext for Child/Detail UserControl/View
    primarykey
    data
    text
    <p>I am new to C# and WPF, so please bear with me..</p> <p>This isn't exactly a Master/Detail scenario, and could be why I am having problems, but generally, I am trying to figure out how to relate two sets of data that are not quite master/detail.</p> <p>To keep it simple, let's say I have two view/viewmodels for </p> <pre><code>1) Person ID, FirstName, LastName 2) Contact ID, PhoneNumber </code></pre> <p>Now, I know normally you think of a Person having several contacts, and it would be something like this:</p> <pre><code> Contact : ID, PersonID, PhoneNumber </code></pre> <p>but for this example, let's continue the way I am going...</p> <p>I have another table, a join table, that has</p> <pre><code>PersonID ContactID </code></pre> <p>Now, if both Bob and Mary have the same phone number, there are 2 entries in the join table</p> <pre><code>1 1 2 1 </code></pre> <p>(assuming Bob is 1, Mary is 2, and 555-555-5555 is ID 1 for the Contact)</p> <p>So, I build the view and viewmodel for the Person, no problem I build the view and viewmodel for the Contact, again no problem</p> <p>Now, how, if I build a view that uses Person as the master and Contact as the detail, to limit the display of only those contacts for the selected person? And likewise, if I have another view of Contact #s and I want to see a list of people associated with that one selected number, how to do this as well.</p> <p>It is probably something easy, but I cannot seem to figure it out. </p> <p>Or, do I need to actually create an ObservableCollection in the Person viewmodel and also ObservableCollection in the Contact viewmodel?</p> <p>Any help would be appreciated. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload