How to get first and last item visible in MAUI CollectionView - Stack Overflow

Using Maui.Controls 9.0.40, primarily for iOS 17.5 and 18.3.I want to know what range of items are CUR

Using Maui.Controls 9.0.40, primarily for iOS 17.5 and 18.3.

I want to know what range of items are CURRENTLY DISPLAYED (that, is visible to the user). This will typically be about 20 items (out of about 500).

It seems like it should be easier than what I've got.

   <CollectionView
      ...
      Scrolled="histDataList_Scrolled"
      >

and

private void myCollectionView_Scrolled(object sender, ItemsViewScrolledEventArgs e) {
    firstVisItem = e.FirstVisibleItemIndex;
    lastVisItem = e.LastVisibleItemIndex;
}

oh, and since the Scrolled event is not called when opened, I've added this crasiness when opened:

   myCollectionView.ScrollTo(1);
   myCollectionView.ScrollTo(0);

I can have up to 1000 items, and I'm trying to offer "select all that are visible", cuz otherwise it's pretty tiresome. What I'm doing can't be the "right" way, is it?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745077933a4609945.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信