I have a collection of recruiters, and each recruiter has a collection of email addresses.
I can select the emailadresses and put them in a collection like:
var query = from e in _container.EmailAddresses select e
this.EmailAddresses = new DataServiceCollection<emailaddresses>(query).
When I make an usercontrol like this
<UserControl>
<DataGrid ItemsSource="{Binding Path=Recruiters"}>
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<ItemsControl ItemsSource="{Binding DataContext.EmailAddresses, RelativeSource={RelativeSource AncestorType=UserControl}}>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Stackpanel Orientation="Vertical"/>
</ItemsPanelTemplate>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBox Text = "{Binding Address"}/>
</DataTemplate>
</ItemtsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</UserControl>
I get on each row the same email addresses, which I understand.
I can get the collection of recruiters with their respective emailaddresses like
var query = from r in _container.Recruiters.Expand(r => r.EmailAddresses) select r
this.Recruiters = new DataServiceCollection<Recruiters>(query).
I would have to bind the usercontrol to Recruiters.EamilAddresses, but that doesn't work.
Any ideas how to accomplish this?
Basically I would like to display a subcollection on each row.
Kind regards
Jeroen