Hi, I was using field.Settings.ResetCellWidth() and field.Settings.ResetLabelWidth() to set column width based on user action in v9.1, I am trying to upgrade to v10.1 and see these methoda are no longer there!!!
Below is what I was doing, without using Reset Cell and Label width setting width does not work!!
foreach (FieldLayout fieldLayout in grid.FieldLayouts) { foreach (Field field in fieldLayout.Fields) { string text; if (widths.TryGetValue(field.Name, out text)) { FormattedText formattedText = new FormattedText(text, CultureInfo.CurrentCulture, grid.FlowDirection, dualGridTypeface, grid.FontSize * (double)grid.GetValue(DualGridViewZoom.ZoomProperty), grid.Foreground);
double width = formattedText.BuildGeometry(new Point()).Bounds.Width;
//field.Settings.ResetCellWidth(); //field.Settings.ResetLabelWidth(); field.Settings.CellWidth = field.Settings.LabelWidth = width; } } }
Can some one from infragsitcs comment? are there any alternatives?
Hi meetnd,
In v10.1 what you can use, instead of CellWidth and LabelWidth, is the Width property of the field.
Something like:
field.Settings.ClearValue(
Field.WidthProperty);
field.Settings.Width =
new FieldLength(18);
Please let us know if this works for you.
Thanks.