I implement fields auto-size logic. When desired width calculated, it's applied for field:
field.Settings.CellWidth = field.Settings.LabelWidth = width;
This code works perfect when for examle underlying data changed. But when user manualy change field width of the column, below code stop works for this column. How invalidate actual field width, so that grid will get it from field.Settings.CellWidth and field.Settings.LabelWidth?
Try next hack, but this not help:
PropertyInfo columnWidthVersionPropertyInfo = typeof(FieldLayout).GetProperty("GridColumnWidthVersion", BindingFlags.Instance | BindingFlags.NonPublic);int version = (int)columnWidthVersionPropertyInfo.GetValue(fieldLayout, new object[{});columnWidthVersionPropertyInfo.SetValue(fieldLayout, version+1, new object[{});
Computed solution - call grid.ClearCustomizations(CustomizationType.FieldExtent);