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
Hello mwicke,
I have been looking into your enquiry and you don’t really seem to have the same issue, since in your code:
expandtTask.Wait();
blocks the main thread before the task has actually started. This is because the Task, that is returned, requires some time to gather metadata before actually starting the expansion. I have tested your code against both 12.2 and 13.1’s latest builds and in both cases your Wait() method is block the main thread, which if you debug will never get you to the RefreshGrid method nor to IsBusy checksum.
In order to execute the refresh I can suggest following Plamen’s suggestion:
IFilterViewModel filterViewModel = (IFilterViewModel)dataSource.Rows[0];
Task expandTask1 = dataSource.ExpandToLevelAsync(filterViewModel, filterViewModel.Hierarchy.Levels.Count - 1);
expandTask1.ContinueWith(t => dataSource.RefreshGrid(), TaskContinuationOptions.ExecuteSynchronously);
or a similar approach:
Task expandTask = dataSource.ExpandToLevelAsync(filterViewModel, filterViewModel.Hierarchy.Levels.Count - 1);
expandTask.ContinueWith(
t => dataSource.RefreshGrid(),
TaskScheduler.FromCurrentSynchronizationContext());
Please let us know if you require any further clarification on the matter.
Hello,
I'm facing exactly the same issue. This seems to be bug which came with Version 13.1 because with the XamPivotGrid in Version 12.2 same function works fine.
To investigate the problem I polled the IsBusy-Flag and can see that this flag is always set to true and runs in an infinit loop.
Can you commit that there is a bug in your control and can you tell me when it is fixed or do have a workaround?
Task expandTask = ( (DataSourceBase)pivotGrid.DataSource ).ExpandToLevelAsync(filterViewModel,filterViewModel.Hierarchy.Levels.Count -1);
expandTask.Wait();
pivotGrid.DataSource.RefreshGrid();
while (pivotGrid.DataSource.IsBusy)
{
Thread.Sleep(100);
}
I have logged this behavior with our developers in our tracking system, with an issue ID of 144614. The next step will be for a developer to review my investigation and confirm my findings or to offer a fix, or other resolution. I will leave this case open and update you with this information after the review. You can also continue to send updates to this case at any time. I have also created a support ticket on your behalf with number CAS-117816-B7R7P1 in order to link the development issue to it so that you are automatically updated when a Service Release containing your fix is available for download.
You can view the status of all development issues connected to this case from the "Development Issues" tab, when viewing this case on the "My Support Requests" page of our website.
Best regards,Plamen
Hi Plamen,
unfortunately it's a customer's environment so i have no impact on which version of .NET is installed.
BR,
Daniel