Everything seems to be working correctly but the actual entered values in the filters are eluding me. Our Design team would like those values to still be in the filter textboxes on a reload.
Here is how I am handling this issue so far (and all seems to be working except for the entered values. We are still on 12.1)
Version # 12.1.20121.2068
private void OnUnloaded(object sender, RoutedEventArgs args) {
XamGrid grid = sender as XamGrid;
if (grid != null) {
if (_viewModel != null) {
_viewModel.Filters = grid.FilteringSettings.RowFiltersCollection;
PersistenceSettings settings = PersistenceManager.GetSettings(grid);
MemoryStream stream = PersistenceManager.Save(grid, settings);
_viewModel.GridSettings = stream.ToArray();
}
The actual settings I am interested in preserving are specified on the XAML. When I added these I was able to reduce the size of the setting byte array considerably.
<ig:PersistenceManager.Settings>
<ig:PersistenceSettings SavePersistenceOptions="OnlySpecified">
<ig:PersistenceSettings.PropertySettings>
<ig:PropertyNamePersistenceInfo PropertyName="FilteringSettings"/>
<ig:PropertyNamePersistenceInfo PropertyName="SortingSettings"/>
</ig:PersistenceSettings.PropertySettings>
</ig:PersistenceSettings>
</ig:PersistenceManager.Settings>
<InfraGrid:XamGrid.FilteringSettings>
<InfraGrid:FilteringSettings AllowFiltering="FilterRowTop" IsEnterKeyEditingEnabled="True" IsMouseActionEditingEnabled="SingleClick">
<ig:PropertyNamePersistenceInfo PropertyName="RowFiltersCollection"/>
</InfraGrid:FilteringSettings>
</InfraGrid:XamGrid.FilteringSettings>
When the grid reloads I do this. Curiously enough the persistence manager seems to be preserving the sort sequence, which is arguably simpler, but not the filters.
private void OnLoaded(object sender, RoutedEventArgs args) {
_viewModel = DataContext as QETGridViewModel;
if ((_viewModel != null) && (grid != null)) {
if (_viewModel.GridSettings != null) {
MemoryStream stream = new MemoryStream(_viewModel.GridSettings);
PersistenceManager.Load(grid, stream, settings);
Hello Nick,
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.