AndreiMisiukevich / CardView

CardsView | CarouselView | CoverflowView | CubeView for Xamarin.Forms
MIT License
710 stars 114 forks source link

UI virtualization #414

Closed Alex-Dobrynin closed 2 years ago

Alex-Dobrynin commented 2 years ago

Does your CarouselView supports UI virtualization some how? E.g. Control will not create views for those items which are not visible and will dispose views for those items user swiped away

AndreiMisiukevich commented 2 years ago

This is a very good question.

This package supports virtualization if you use datatemplate and bindings mechanism (and it's enabled by default)

And this is customizable! https://github.com/AndreiMisiukevich/CardView/blob/master/docs/CardsView.md

MaxChildrenCount & DesiredMaxChildrenCount manages maximum views which could be added to the screen at the same time.

ShouldShareViewAmongSameItems - Set to force all same items to use the same view at the same moment. IsViewReusingEnabled - Determines whether the control should try to retrieve a view from the views pool or create its own view for a certain item.

Alex-Dobrynin commented 2 years ago

May be you should rename MaxChildrenCount -> MaxVisibleChildrenCount to make it more clear. But thanks

AndreiMisiukevich commented 2 years ago

May be you should rename MaxChildrenCount -> MaxVisibleChildrenCount to make it more clear. But thanks

That's actually not max visible children.

MaxChildrenCount is a hard limit of views that can be added to Children collection at the same time. (But they will be IsVisibe="False").

DesiredMaxChildrenCount is a soft limit (the difference is CardsView is aiming soft limit, but if some interaction happens, cardsview won't slow down the performance and remove some views, it will wait for either interaction to stop or hard limit.

AndreiMisiukevich commented 2 years ago

only 1 or 2 views are visible for the carousel/cards/cube at the same time