Depending on how you are being notified that an item is being selected for expansion you will need to find the row the user is in:
DataGridRow row = DataGridRow.GetRowContainingElement(...);
and update the row details visibility:
row.DetailsVisibility = Visibility.Visible;
Those details aside, you need to create a style for the details rows -- which is wired to an event you can listen to:
<DataTemplate x:Key="DetailsRowTemplate">
<StackPanel>
<Border BorderBrush="{StaticResource BlackBrush}" BorderThickness="0,2,0,0" Padding="0" >
<data:DataGrid ItemsSource="{Binding DummyResultsView}" AutoGenerateColumns="False"
LoadingRow="DataGrid_LoadingRow"
CanUserResizeColumns="False"
CanUserReorderColumns="False"
HeadersVisibility="None"
IsReadOnly="True">
</data:DataGrid>
</Border>
</StackPanel>
</DataTemplate>
which is set as the RowDetailsTemplate for your grid:
Within the LoadingRow event you can obtain a reference to which data context is involved, and save a reference to the child data grid so that after a WCF call you can set the ItemsSource:
private void DataGrid_LoadingRowDetails(object sender, DataGridRowDetailsEventArgs e)
{
List<DataGrid> detailElements = e.DetailsElement.GetChildrenByType<System.Windows.Controls.DataGrid>().ToList();
var itemSelected = e.Row.DataContext;
if (detailElements.Count > 0)
{
DataGrid detailsDataGrid = detailElements[0];
// save a reference so the ItemsSource can be set later....
this.DataGrid = detailsDataGrid;
this.Model.InitializeDetailsList(detailsDataGrid, itemSelected);
}
}
Hope that helps,