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,

Below is my initial posting and a response from Andrew Smith to my inquiry that I had accidentally posted on the dock manager forum.  I'm still not clear on what it takes to produce a grid where the columns use 100% of the grid width, allow the user to move and resize columns, and then save/restore the column locations PLUS the user modified column widths.  After all, what's the use of allowing our users to resize columns if we can't subsequently restore them to that size?  I've seen various posts about setting CellWidth and LabelWidth but it seems to have to no effect.  Any help /tips/inspiration/sample code will be greatly appreciated.

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

And Andrew's response:

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:
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:

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:

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).

 

Parents
No Data
Reply
  • 54937
    Offline posted

    Just to clarify, from what I understand of your situation the reason you are not seeing the "widths" carry over is because the widths are coming from the ColumnDefinitions in your DataRecordCellAreaGridTemplate. If you did not use the template grid then the widths would be those of the fields themselves and would be maintained as the user moved columns and would be saved in the layout file.

Children
No Data