I have a hierarchical dataset bound as the datasource to a datagrid. The rows in the parent table show up in the grid, and all the rows have an expansion indicator on their left. However, some of the rows in my datasource do not have corresponding rows in the child table. For these, I don't want the expansion indicator to appear, so that the user can easily tell which rows have children and which do not. Is this possible?
thanks,
- Kam
I just figured this out, and figure I'd post it here in case anyone else was interested:
Handle the InitializeRecord event, and in your handler set the Record's ExpansionIndicatorVisibility propery according:
e.g.
private void OnInitializeRecord(object sender, InitializeRecordEventArgs e) { if (e.Record != null) { if (e.Record.HasChildren) e.Record.ExpansionIndicatorVisibility = Visibility.Visible; else e.Record.ExpansionIndicatorVisibility = Visibility.Hidden; }
}