Note that there are some explanatory texts on larger screens.

plurals
  1. POMany to Many (Students , classes example) Datagrid xaml binding
    text
    copied!<p>I have a WPF / entity framework application, my model have student , class entities there is a many to many association/relation between student and class (student can have many classes and class have many students )</p> <p>student [ Id ,Name , Classes(Navigation property) ] classes [ Id ,Title, Students(Navigation property ] </p> <p>in this case the entity framework don't show the join/relation table.</p> <p>i have a 2 DataGirds as master details, student grid is the master and classes is details</p> <p>how can i set the binding to classes gird (the details gird) so i can add and remove classes to the selected student?</p> <p>what i want is to select a student from the master grid and add or remove his classes</p> <p>this is my classes gird </p> <pre><code>&lt;DataGrid x:Name="classesDataGrid" AutoGenerateColumns="False" EnableRowVirtualization="True" Height="200" ItemsSource="{Binding Source={StaticResource studentClassesViewSource}}" RowDetailsVisibilityMode="VisibleWhenSelected" Width="380"&gt; &lt;DataGrid.Columns&gt; &lt;DataGridComboBoxColumn Header="Class Name From Combo" Width="*" ItemsSource="{Binding Source={StaticResource classViewSource}}" DisplayMemberPath="Name" SelectedItemBinding="{Binding Students}" /&gt; &lt;!--&lt;DataGridTextColumn x:Name="durationColumn" Binding="{Binding Duration}" Header="Duration" Width="SizeToHeader" /&gt;--&gt; &lt;/DataGrid.Columns&gt; </code></pre> <p>This scenario works fine when the relation is one to many but i couldn't make it work for many to many relations .</p> <p>More on this post <a href="http://social.msdn.microsoft.com/Forums/vstudio/en-US/74ca2429-cb22-4b24-ae22-01a842b7d8c2/many-to-many-students-classes-example-datagridcomboboxcolumn-binding-problem" rel="nofollow">here</a></p>
 

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