Reputation: 2106
How do I customize the Winforms DataGridView to support expanding and collapsing with a +/- sign?
Thanks.
Upvotes: 1
Views: 8641
Reputation: 53593
The DataGridView does not support the +/- row header button you're looking to display hierarchical data in.
What you are looking for is the DataGrid, which was replaced by the DataGridView starting .NET 2.0. The DataGrid is still available for use in later versions of the Framework however (both for backwards compatibility and I'm sure to make this feature available):
DataGrid Control Overview (Windows Forms)
How to: Create Master-Details Lists with the Windows Forms DataGrid Control Using the Designer
I've done this before in a .NET 2.0 project and as I recall the +/- buttons work only with two related DataTables in a DataSet. It was a bit of a struggle to get the DataGrid to work that way I wanted (DGV is much easier to work with).
Upvotes: 4