I haven't tried dynamically changing the width of the column when cell values change but I use this method to set the column width from the header. You may want to add extra padding to get the best results
private static int MeasureTextWidth(Control c, string text)
{
if (c == null)
{ return -1; }
using (Graphics g = c.CreateGraphics())
{
return (int)Math.Ceiling(g.MeasureString(text, c.Font).Width);
}
}
Edit: extra note I have tried implementing a auto width feature for columns by overriding the Width property on the column with my own logic. Unfortunately it seems that DataGridColumn doesn't use the Width property to get its width. Just incase you were thinking about going that route.