You can set this last column size in the CurrentCellShowingDropDown event. There is a 8 pixel border on each side of the dropdown window that explains the 16 pixel fudge factor in the code below. Also, on the very first drop, the grid has not been initialize fully yet, so the code gets things like row count and column count from the DataSource (which the code assumes is a DataTable). GridA is the embedded grid in the drop window.
private bool bFirstTime = true;
private void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
if(bFirstTime && this.gridControl1[cc.RowIndex, cc.ColIndex].CellType == "GridADropCell")
{
bFirstTime = false;
GridA.AllowResizeToFit = false;
DataTable dt = GridA.DataSource as DataTable;
if(dt != null)
{
int cols = dt.Columns.Count;
int sbWidth = SystemInformation.VerticalScrollBarWidth;
int rows = (GridA.EnableAddNew) ? dt.Rows.Count + 1 : dt.Rows.Count;
if(rows * GridA.DefaultRowHeight + GridA.Model.RowHeights[0] + 16
< e.Size.Height)
{
sbWidth = 0;
GridA.VScrollBehavior = GridScrollbarMode.Disabled;
}
int width = e.Size.Width - GridA.Model.ColWidths.GetTotal(0, cols-1) - sbWidth - 16;
GridA.Model.ColWidths[cols] = width;
}
}
}