I have a DataGrid that contains a few rows and column header.
I wish to change the DataGrid height to be the exact height of the total
height of the rows and column header, so that no gray area will be shown
below the last row.
I tried:
int totalRowsHeight = dataTable.Rows.Count *
(dataGridTableStyle.PreferredRowHeight + 1);
Size gridClientSize = dataGrid.ClientSize;
gridClientSize.Height = totalRowsHeight;
dataGrid.ClientSize = gridClientSize;
But it causes the DataGrid to be too small.
Can anybody tell me how can I do that ?
--------
Thanks
Sharon