I need to be able to display parent / child rows in a WPF datagrid, the parent are displayed with a plus / minus control which when clicked shows the related children record
Even i have the same requirement. I have implemented the condition in following way. When the expander is opened, you can have the following code.
private void Expander_Expanded(object sender, RoutedEventArgs e)
{
foreach (var item in viewModel.Results)
{
if (item.SubResults.Count > 0)
{
item.SubResults.SelectedItem = null;
}
}
}
Where Results is the items source for my outer grid, and Subresults is the datasource for my inner grid. This code helps to reset the selected item, whenever the expander is opened.