Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
932
field.Settings.ResetCellWidth() and field.Settings.ResetLabelWidth() are removed in v10.1
posted

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?

  • 3520
    Offline posted

    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.