相當於處理一下AutoGeneratedColumns的事件,設定一下最小值和最大值
dataGrid.AutoGeneratedColumns += (s, e) =>
{
foreach (var column in dataGrid.Columns)
{
column.MinWidth = 80;
column.MaxWidth = 400;
}
};