How to resize parent and child grid columns in WinForms GridControl?
In WinForms GridControl, when resizing a parent grid column, the corresponding child grid columns can also be resized based on the parent column width by using the TableModel.ColWidthsChanging event. Within this event, the widths of the nested table columns can be adjusted proportionally to reflect the changes made to the parent column.
//Event subscription
gridGroupingControl1.TableModel.ColWidthsChanging += OnColWidthsChanging;
//Event customization
private void OnColWidthsChanging(object sender, GridRowColSizeChangingEventArgs e)
{
int col = e.From;
GridTable table1 = this.gridGroupingControl1.GetTable("ChildTable");
table1.TableModel.ColWidths[col - 1] = Convert.ToInt32(e.Values.GetValue(0));
}
Take a moment to peruse the WinForms GridGroupingControl - Columns documentation, to learn more about managing records and columns with examples.
Conclusion
I hope you enjoyed learning how to resize parent and child grid columns in WinForms GridControl.
You can refer to our WinForms GridControl feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications.
You can also explore our WinForms GridControl example to understand how to create and manipulate data.
For current customers, check out our components from the License and Downloads page. If you are new to Syncfusion, try our 30-day free trial to check out our other controls.
Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!