3

I'm trying to create table editor for multi-level table data using standard wpf datagrid. Is it possible to create nested structure something like this?

Syncfusion datagrid

With standard row details nested grids looks ugly, because row details must have fixed height (so i will get multiple scrolls)

My demo application

1
  • You might go at this with a treeview and templates. Commented Feb 21, 2014 at 14:12

1 Answer 1

9

Each DataGrid can have something called a RowDetailsTemplate. The template can have anything you want in it, including another DataGrid. If that DataGrid uses the same RowDetailsTemplate, you can have a DataGrid nested inside a DataGrid ad-infinitum.

Check out this article for an example of using the RowDetailsTemplate. You just need to modify the XAML there to use your own template.

Sign up to request clarification or add additional context in comments.

2 Comments

but what about multiple scroll bars? is it possible to stretch rowdetails height to fit content height?
@cmd I've never tried that. I suppose you could bind the Height of the DataGrid in the RowDetailsTemplate to a property of the row in it. You'd have to recursively loop through all of the objects in that nested object which populates the nested DataGrid in order to figure out the height.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.