Open bnORISHA opened 5 years ago
I took your xaml and copy pasted it in the silly app ListView.xaml page, and CurrentIndex is well bound. It changes when you scroll the list. Sorry.
Sorry, I did reproduce it :) But your description was unaccurate: you have to get focus of the entry to make it happen.
Here what happens:
Spent last 2 hours trying to figure out why... Any help appreciated :)
Sorry I forgot about focus... I tried to update to Xamarin.Forms 4.0.0.497661. Same problem. It's weird. The problems occurs only when I set HorizontalTextAlignment to "Center" or "End". It's good with "Start".
I've seen something in AndroidHorizontalListViewRenderer.OnControlScrollChangedListener.cs.
private void UpdateCurrentIndex(AndroidHorizontalListViewRenderer nativeView, CancellationToken token)
on lines 151 & 152.
int firstItemIndex = nativeView.LinearLayoutManager.FindFirstVisibleItemPosition();
int lastItemIndex = nativeView.LinearLayoutManager.FindLastVisibleItemPosition();
Why not FindFirstCompletelyVisibleItemPosition() & FindLastCompletelyVisibleItemPosition() ?
When you set SnapStyle to Center you want to get the index of the item in the middle of the screen. If you use FindFirstCompletelyVisibleItemPosition and FindLastVisibleItemPosition some cases won't work.
Hi, im currently having the same problem that the HorizontaList automatically scrolls to the beginning when a User taps on a Control that takes input from the user ( e.g. Entry or Picker). The Cursor stays in the Control the User tapped but the List now displays the first item. This behaviour only occurs when the HorizontalTextAlignment Property is set on the Control the User taps and the List's layout is linear or Carousel. When HorizontalTextAlignment is not set, the HorizontalList just works fine with linear and Carousel layout. I also tried the CarouselView of Xamarin.Forms instead of the HorizontalList but the same behaviour occured when the HorizontalTextAlignment property was set. Maybe this Issue is not directly caused by the HorizontalListView Library. Is it possible that something in Xamarin.Forms is not working as excpected, which causes this weird behaviour?
Xamarin Forms Version: 5.0.0.2012 Sharpnado.Forms.HorizontalListView Version: 1.8.2 Thanks for any help in advance and all the people who created this awesome Library :)
"HorizontalTextAlignment" of the entry matters, what a bug!
I am using HorizontalListView as a carousel. There is an Entry in it. But when I set HorizontalTextAlignment of the Entry to Center, current index of HorizontalListView is reset to zero. When I don't set HorizontalTextAlignment it works well. I have the same problem when I use a custom renderer of Entry and I set Gravity to Center.
XAML : `<renderedViews:HorizontalListView x:Name="FruitList" ColumnCount="1" HorizontalOptions="FillAndExpand" ItemSpacing="0" ListLayout="Linear" ScrollSpeed="Slowest" SnapStyle="Center" VerticalOptions="FillAndExpand">