Hi There,
In a XamGrid (Infragistics 11.1), I am saving the layout of the Grid at application startup, and then allowing the user to select different views of the grid which retrieves a saved grid layout, and applies it.
If they select No Layout, it should revert to the original setup.
There are a few issues that arise with usage.
Firstly, I am required to create a new MemoryStream from the original Grid settings each time, rather than being able to use the persistence settings as a singleton, for example:
PersistenceManager.Load(grid, _gridSettings);
where _gridSettings is the settings taken at startup, this will fail the second time it is used. The first time it is applied correctly.
I get around this by using
var settings = new MemoryStream(_gridSettings.ToArray()); PersistenceManager.Load(grid, settings);
var settings = new MemoryStream(_gridSettings.ToArray());
PersistenceManager.Load(grid, settings);
I cannot see how this would differ, but it avoids the invalid XML at [0,0] error that the first example gives.
The second issue, is that the grid appears to only accept a couple of settings changes before it starts to behave oddly.
For example, view 1 has a grouping, and a particular order of columns.
View 2 has several groupings, and a different column order.
The first switch from No view to View 1 works correctly.
Now Changing to View 2 works correctly.
Then changing to No View updates the data in the collection, but the XamGrid does not change the settings, or reflect the change in data in the collection.... Changing to ANY view at this point will not change the settings or show the new data in any way.. it is locked to the View 2 settings AND data despite the data and settings appearing to be completely different.
I have tried on every switch of settings to reset the grid back to default by loading the No View settings, then InvalidateArrange(), InvalidateData(), InvalidateMeasure() before applying the new settings, and the ObservableCollection is Nulled before applying the new Data, but this does not work at all.
Is there a way to ensure that the grid responds correctly to the loading of the settings time and time again?
I hope this is clear enough, and I will be pleased to give any more information that you may require to help with this.
Hello Matt,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Thank you for your post. I have been looking into it, but since this is not a known issue I wasn’t able to reproduce your behavior. Could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
I tracked down the source of the bug in the tenacious gripping hold of the data/settings despite things changing in the ViewModel, and it was down to a custom behaviour.. I am not sure WHY this was breaking the Grid, but if I find out I will be sure to follow up the post just in case anyone else comes across the same problem.
EDIT : Actually, still the same issue..