We have multiple XamDataGrids inside a XamDockManager. The most common scenario has four tabs with three XamDataGrids and a single XamChart. I need to be able to store the freeze pane location for any/all XamDataGrids where the user has defined one.
In our app, users can select the displayed columns so we are already using ClearCustomizations(CustomizationType.FieldPosition | CustomizationType.CardViewSettings | CustomizationType.Summaries), SaveCustomizations(), <add/drop columns/fields as requested by the user>, LoadCustomizations().
I am already saving layout info via XamDockManager which isn't the same thing as saving within a XamDataGrid but it speaks to the complexities in doing a save on close in a MVVM app.
VS 2010 SP1 WPF/MVVM InfragisticsWPF4.v10.3 InfragisticsWPF4.DataPresenter.v10.3
Thx,
Ivan
Hello Ivan,
Were you able to resolve your issue by saving the layout of the XamDockManager?
Valerie
To save the customizations on the xamDocManager you would need to call SaveLayout and LoadLayout for the XamDockManager in addition to saving / loading the Customizations for each grid. To learn more on saving / loading layouts for the xamDocManager, please see
http://help.infragistics.com/Help/NetAdvantage/WPF/2010.3/CLR4.0/html/xamDockManager_End_User_Settings.html
If you are having an issue saving / loading the customizations for the XamDataGrid can you provide a sample demonstaring the error you are receiviing so that I may be of more assistance.
Thanks,
Hi Valerie,
We're talking about two different scenarios.
1) A user sets the freeze pane and closes the app. I need to be able to reload that settings.
2) A user changes the column displayed on the grid. In this scenario, I have to clear out all of the field position info before I reload the customizations. If I don't I get an error. It's been a while since I worked on that bit of code so I don't remember the exact error, but I know there is one. We never actually save the customization to disc.
Here's the code snippet from the attached behavior:
grid.ClearCustomizations(CustomizationType.FieldPosition | CustomizationType.CardViewSettings | CustomizationType.Summaries); // clear customizations we don't care about var customization = grid.SaveCustomizations(); if (grid.FieldLayouts.Count == 0) grid.FieldLayouts.Add(new FieldLayout()); grid.FieldLayouts[0].FieldSettings.Width = new FieldLength(defaultFieldWidth); // set the default field width when there's no customization grid.FieldLayouts[0].Fields.Clear(); fields.ForEach(i => grid.FieldLayouts[0].Fields.Add(i)); grid.LoadCustomizations(customization);
Scenario #1 is the one I'm focused on right now. It sounds like I need save each grid's customizations then reload then at start-up of the next session.
Does that sound right?
I am unsure exactly what you are asking. If you want to save the users settings for fixed columns, this will be saved when using SaveCustomizations / LoadCustomiztions as long as you do not call ClearCustomizations with CustomizationType.FieldPosition before saving the customizations, this will remove the fixed columns settings.