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
1170
Gracefully add new columns to an application with saved customizations
posted

I've got an application where users can customize their xamdatagrid field layout and the changes are saved at the end of each session. When a request comes in to add an additional column to the application, I want the new column to be appended to the end of the grid. But when the column ordering has been changed it seems like the new column will be assigned a somewhat random position.

I've tried to resolve this by handling the FieldLayoutInitialized event and iterating over the fields, tracking any fields  that weren't in the last saved layout, then going over that subset of fields to move them to the edge of the grid. It doesn't seem to work, either usingthe Fields.Move(...) method or setting a new ActualPosition with my desired column number.

Is there an officially sanctioned way to integrate a new column into a saved layout without upsetting the position of the existing columns?

Parents
No Data
Reply
  • 34810
    Suggested Answer
    Offline posted

    Hello J. Moran,

    Thank you for your post.

    I have been investigating into this issue that you are reporting, but as of yet, I have not been able to reproduce this issue that you are seeing. When a Field is added to a XamDataGrid, I would expect that it is always added to the end of the collection of your Fields which would cause it to show up in the grid as the last field. This is the behavior that I am seeing. There is an exception to this, and that is when you set the XamDataGrid.FieldLayoutSettings.AutoArrangeCells property to "Never." With this setting, the fields are still added to the collection in the same order, but you will need to explicitly define where they should show up. You can read more on this in our online documentation article about it, here: http://help.infragistics.com/Help/Doc/WPF/2012.1/CLR4.0/html/xamData_Arranging_Cells_within_the_Record.html. Are you setting this property in your application? Also, would it be possible for you to provide more detail on when exactly your Field is being added to your XamDataGrid?

    I have attached the sample project I used to test this.  Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.

    If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using.  My test was performed using version 15.2.20152.2038 in Infragistics for WPF 2015.2.

    If the project does show the product feature working correctly, this indicates a possible problem in the code of your application.  It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.

    Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

    XDGFieldPositionCase.zip
Children