Hi John,
You could achieve the desired behavior by handling the TableControl.SizeChanged and QueryColWidth event. See the code:
int indentCols;
int parentIndentCols;
private void TableModel_QueryColWidth(object sender, GridRowColSizeEventArgs e)
{
GridTableModel gridModel = sender as GridTableModel;
GridTableControl grid = (GridTableControl)gridModel.ActiveGridView;
if (gridModel != null && grid != null)
{
int availableArea;
int VSBarSize = 0;
if (VScrollVisible)
VSBarSize = SystemInformation.VerticalScrollBarWidth;
indentCols = (gridModel.GetColumnIndentCount()) * grid.GroupingControl.TableOptions.IndentWidth;
if (e.Index > gridModel.Cols.HeaderCount + gridModel.GetColumnIndentCount() - 1)
{
parentIndentCols = VScrollVisible ? indentCols : indentCols - SystemInformation.VerticalScrollBarWidth;
availableArea = grid.GroupingControl.ClientSize.Width - indentCols - VSBarSize;
e.Size = (int)availableArea / (grid.TableDescriptor.VisibleColumns.Count);
e.Handled = true;
}
}
}
private bool VScrollVisible = false;
private void TableControl_SizeChanged(object sender, EventArgs e)
{
VScrollVisible = this.gridGroupingControl1.TableControl.VScroll;
GridTableControl tableControl = sender as GridTableControl;
tableControl.Invalidate();
}
Sample for your reference,
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GGC-1100757244.zipPlease let me know if this helps.
Regards,
Jisha