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
1160
Restoring user customizations
posted

Hi!

My app allows the user to rearrange the columns as well as resize the column widths (driven by the interesting side effect that the moved column picks up the width of the column whose location it's moving into (i.e. if column 6 is originally 80 wide and column 2 is 20 wide and you move column 6 between column 1 and 2 it becomes 20 wide).  However the SaveCustomizations does not save the widths.  So I'm saving off the cellwidthresolved and labelwidthresolved properties separately and then restoring the saved customizations followed by the cellwidth and label width.  I can see in the debugger that the widths are getting changed but the grid always shows the widths as calculated by the grid.  I suspect that this has to do with using AutoFit=True (because I need the columns to use all of the grid width) and defining a DataRecordCellAreaGridTemplate | ItemsPanelTemplate | Grid with various widths specified for the columns (some specific, some 40*, 60*, etc.).  

What is the correct combination of settings I need to set to achieve 100% grid width usage by the columns (no empty space on the right), moving and resizing of columns, and saving/restoring the grid to how the user left it?

Additionally is there a way to prevent certain columns from being moved or dropped between?

Thanks!

Glenn

  • 54937
    Offline posted

    I would recommend reposting this in one of the xamDataGrid related forums as this one is specific to xamDockManager but I'll try to answer what I can.

    les122 said:
    I suspect that this has to do with using AutoFit=True (because I need the columns to use all of the grid width) and defining a DataRecordCellAreaGridTemplate | ItemsPanelTemplate | Grid with various widths specified for the columns (some specific, some 40*, 60*, etc.

    The column definitions in a template cellarea grid is not specific to a single field (you can have multiple fields that are using a given column definition based on its Column|Row & (Column|Row)Span properties. So dragging a field does not "carry" this information.

    les122 said:

    What is the correct combination of settings I need to set to achieve 100% grid width usage by the columns (no empty space on the right), moving and resizing of columns, and saving/restoring the grid to how the user left it?

    AutoFit does not require the usage of a template cellareagrid so just using AutoFit would ensure that there is no empty horizontal space (in a vertical layout) and will allow you to move columns. Currently there is no property to limit which fields will get increased/decreased in size outside of their min/max properties (e.g. MinCellWidth). This should be entered as a feature request.

    les122 said:

    Additionally is there a way to prevent certain columns from being moved or dropped between?

    No since the repositioning of any field could implicitly affect the position of another field (e.g. move the field in the 1st logical column to the end and therefore what field was in the 2nd logical column is now the 1st logical column).