ProgressRing causes Layout cycle error

If you use a lot of ProgressRing (in ListViewItem or a GridViewItem) in a View, you can have the infamous error Layout Cycle Error.

This blog post points the fact you have to hide (Visibility = Collapsed) the non active (IsActive=False) ProgressRing. That’s a good point BUT if the ProgressRing has to be visible, what’s the trick ?

The issue is the ProgressRing takes too much time to calculate its own measures, so if you have, 50/60 ProgressRing and you ask for a Resize => Layout Cycle Error (it’s a timeout for sure). It depends of your CPU, so it could be ok on a fast CPU and throw the error on a slow CPU, but you can’t take the risk…

SOLUTION

Do never use ProgressRing in list DataTemplates, this control is too heavy for that. ProgressBar with IsIndeterminate=True has also the same issue, so don’t use it too.

That’s not what you want to read but build your own – fast – progress control and layout cycle error will not be your nightmare anymore ;).

 

This entry was posted in UWP, Windows Phone 8, WinRT. Bookmark the permalink.