A "grid in grid"

Nov 23, 2008 at 6:59 PM

What is the prefered approach for adding another grid in the grid, tied to each row.
My best guess is to add it in the RowDetailsTemplate, would that be a good place for building this feature?

Nov 24, 2008 at 8:51 AM

 Your guess is right, at least this is how I implemented it. Here is an example:

 I've declared a datatemplate

<DataTemplate x:Key="AssociationTemplate" DataType="{x:Type commonInterfaces:IRelation}">
                <ListBox ItemsSource="{Binding Path=RelationEntities}">
                            <toolkit:DataGrid HeadersVisibility="Column" AutoGenerateColumns="True"
                                              CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="True" IsReadOnly="True"
                                              GridLinesVisibility="Horizontal" Background="Transparent"
                                              ItemContainerStyleSelector="{StaticResource ListViewItemStyleSelector}"

And here is how I use the datatemplate
<toolkit:DataGrid Name="dataGrid" RowDetailsTemplate="AssociationTemplate" />

work like a charm.