quite simple...
public partial class Window1 : Window
{
DataTable dt = new DataTable();
public Window1()
{
InitializeComponent();
dt.Columns.Add("AA", typeof(string));
dt.Columns.Add("BB", typeof(string));
dt.Columns.Add("CC", typeof(string));
dt.Rows.Add("11", "22");
dt.Rows.Add("22", "33");
dt.Rows.Add("33", "44");
dataGrid1.ItemsSource = dt.DefaultView;
this.dataGrid1.RowDetailsVisibilityChanged += new EventHandler<Microsoft.Windows.Controls.DataGridRowDetailsEventArgs>(datagrid1_RowdetailsVisibilityChanged);
}
void datagrid1_RowdetailsVisibilityChanged(object sender, Microsoft.Windows.Controls.DataGridRowDetailsEventArgs e)
{
Microsoft.Windows.Controls.DataGrid innerDataGrid = e.DetailsElement as Microsoft.Windows.Controls.DataGrid;
innerDataGrid.ItemsSource = ((IListSource)dt).GetList();
}
in xaml file write the code
<my:DataGrid.RowDetailsTemplate>
<DataTemplate>
<my:DataGrid Name="datagrid2"></my:DataGrid>
</DataTemplate>
</my:DataGrid.RowDetailsTemplate>
</my:DataGrid>
</Grid>