Hello there
I'm trying to expand all Rows programmatically which _usually_ works with the following code:
var filterViewModels = PivotGrid.DataSource.Rows.Where(fvm => fvm is IFilterViewModel).ToList();
for (int i = 0; i < filterViewModels.Count; i++) { var filterViewModel = filterViewModels[i] as IFilterViewModel; if (i == filterViewModels.Count - 1) { ((DataSourceBase)PivotGrid.DataSource).ExpandToLevelAsync(filterViewModel, filterViewModel.Hierarchy.Levels.Count - 1).ContinueWith( (t) => PivotGrid.DataSource.RefreshGrid(), TaskContinuationOptions.ExecuteSynchronously); } else { ((DataSourceBase)PivotGrid.DataSource).ExpandToLevelAsync(filterViewModel, filterViewModel.Hierarchy.Levels.Count - 1); } }
##################
I used the word usually because in certain environments my application hangs on "PivotGrid.DataSource.RefreshGrid()" (hangs means doesn't respond to anything while having 0% CPU usage)
This occurs on 2 PCs with the same configuration:
HP Compaq Elite 8300 SFF
Intel Core i5-3570Win 7 32 bit
This Error occurs only when i try to expand all rows programmatically (using the "+"-indicators of the UI works as expected),
expanding single Nodes by Code (eg. when restoring a previous saved state of the grid) works flawlessly.
Does anyone have an Idea how to fix/avoid this? I really need this functionality...
BR
Is it acceptable for you and what would be impact of updating to .NET4.5?
Thanks,Plamen
There are indeed differences in .net versions:
The PC that's having problems is running .net 4.0.30319 whilst my pc (and AFAIC all other machines i tested with) is running 4.5.50709.
Hello,
Are there any differences between .NET versions you have installed on these machines? If there are no differences what's the version of .NET they have?
Hello Plamen,
I'm operating with one Hierarchy with 4 Levels beneath, i attached 2 screenshots to illustrate what i'm doing.
The Code you provided me with didn't change that behaviour - As soon as RefreshGrid is called the Application stops.
BR,
Daniel
####
How many hierarchies you operate with when this happen? Could you try to refresh grid once you have all nodes expanded. I mean if you collect the task objects which ExpandToLevelAsync return and then refresh the grid:
Task.Factory.ContinueWhenAll(tasks.ToArray(), t => PivotGrid.DataSource.RefreshGrid(), TaskContinuationOptions.ExecuteSynchronously);
Regards,Plamen.