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
330
How to check if a FieldLayout has become Explicit
posted

Hi,

if one fixes columns in the near end of the grid, the FieldLayout becomes "explicit". Then the code:

DataGrid.FieldLayouts[0].Fields.Insert(1, field); works in a different way, than before the fixing. The field is added always at the end of the Layout and the ActualPosition is not anymore the given index (1).


How can one check if the Layout is Explicit, so that one can take measures and manipulate the field.ActualPosition himself? Is there a Property which tells me, whether the Layout is "explicit" or not?


Regards,

George

Parents
No Data
Reply
  • 22015
    posted

    Hello George,

     

    Thank you for your post!

     

    I have been looking into question. The layout of the field becomes explicit when the end user moves, fixes, hides a field, etc. When one of these operations is made you can use the following code snippet for inserting the Field.

    DataGrid.FieldLayouts[0].Fields.Insert(1, field);

     

    field.ActualPosition = new FieldPosition(1, 0, 1, 1);

    foreach(var f in DataGrid.FieldLayouts[0].Fields)

    {

     if (f != field && f.ActualPosition.Column >= 1)

      {

       var pos = f.ActualPosition;

         f.ActualPosition = new FieldPosition(pos.Column + 1,

          pos.Row, pos.ColumnSpan, pos.RowSpan);

      }

    }

     

    Please do not hesitate to let me know if you have any further questions on this matter.

Children