I have a SL application with many DataGrids (from Silverlight Toolkit), each on its own view. If several DataGrids are opened, changing between views (TabItems, for example) takes a long time (few seconds) and it freezes the whole application (UI thread).
The more DataGrids are loaded, the longer the change takes. These DataGrids that slow the UI chanage might be on other places in the app and not even visible at that moment. But once they are opened (and loaded with data), they slow showing other DataGrids. Note that DataGrids are NOT disposed and then recreated again, they still remain in memory, only their parent control is being hidden and visible again.
I have profiled the application. It shows that agcore.dll's SetValue function is the bottleneck. Unfortunately, debug symbols are not available for this Silverlight native library responsible for drawing.
The problem is not in the DataGrid control - I tried to replace it with XCeed's grid and the performance when changing views is even worse.
Do you have any idea how to solve this problem? Why more opened controls slow down other controls?
I have created a sample that shows this issue: VS solution, live demo
UPDATE: Using VS11 profiler on the sample provided suggests that the problem could be in MeasureOverride being called many times (for each DataGridCell, I guess). But still, why is it slower as more controls are loaded elsewhere? Is there a way to improve the performance?
UPDATE 2: I should mention that I don't use TabControl in my particular application. I use Caliburn.Micro and ContentControl to show currently active ViewModel. But the same issue is with TabControl so I used it to describe the core problem.