Closed Stuart88 closed 4 years ago
First, nice app!
Second, I strongly suspect you're hitting the same problem that is described here: https://github.com/xamarin/Xamarin.Forms/issues/9200#issuecomment-643822589
ListView is not as good as CollectionView is at virtualization. That's good because your app will be much more responsive. The tradeoff is that you need to be explicit about the bindings for complex templates.
Description
SKCanvas objects render incorrectly in the last couple of cells of a larger
CollectionView
The images are LaTex equations created via the CSharpMath Latex library, which utilises SkiaSharp to turn LaTex equation string into an
SKCanvasView
object.So
SKCanvasView
is what the CollectionView is having problems with, I believe.If I use a
ListView
instead, the issue does not occur.Steps to Reproduce
CollectionView
to large list of items where one of the bindings is to anSKCanvasView
(or more specifically aMathView
from theCSharpMath.Forms
library)Expected Behavior
Items rendered correctly
Actual Behavior
Last item(s) of list show repeat of first item(s)
Information
Screenshots
Reproduction Link
The following branch can be built to see the issue in action
https://github.com/Stuart88/pure-physicist/tree/wip/collection-view-problem
To locate the issue in the app (Android), navigate to: Menu -> Topics -> Classical Mechanics -> Equations
Relevant files:
XAML page containing the
CollectionView
https://github.com/Stuart88/pure-physicist/blob/wip/collection-view-problem/PurePhysicist/PurePhysicist/Views/Topics/EquationsViewBase.xamlCode-behind https://github.com/Stuart88/pure-physicist/blob/wip/collection-view-problem/PurePhysicist/PurePhysicist/Views/Topics/EquationsViewBase.xaml.cs
Workaround
Currently using ListView instead