question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[HorizontalListView] Current index reset to zero when a ViewCell Entry get focus

See original GitHub issue
  • OS: Android
  • Device: Huawei P20 Lite
  • Sdk vervion: Android SDK 27
  • Xamarin.Forms: 3.6.0.344447

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"> <renderedViews:HorizontalListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout> <Label HorizontalTextAlignment="Center" Text="{Binding .}" VerticalTextAlignment="Center" /> <Entry HorizontalTextAlignment="Center" Placeholder="Entry" /> </StackLayout> </ViewCell> </DataTemplate> </renderedViews:HorizontalListView.ItemTemplate> </renderedViews:HorizontalListView>

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
meierhoeferjanniscommented, Oct 25, 2021

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 😃

0reactions
shawyunzcommented, Nov 5, 2021

“HorizontalTextAlignment” of the entry matters, what a bug!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Focus on next entry in ListView on Completed event
You could find all the entry in the listview, get the index of the current and then set the focus to the next...
Read more >
ListView - .NET MAUI
The .NET MAUI ListView displays a scrollable vertical list of selectable data items. ListView supports displaying headers and footers, ...
Read more >
Is it possible to display more than 1 item on carousel view?
If you want to display 3 item per view side by side, you can custom the contentView of card:CarouselView , now you only...
Read more >
Read more
... ://www.syncfusion.com/forums/141075/set-current-date-after-open-datepicker ... www.syncfusion.com/forums/143411/getting-the-index-of-the-presented-item ...
Read more >
Xamarin Community Forums - RSSing.com
Nuget package here. Bug Fixes. 44338 - "Displaying context action causes ArgumentNullException when another item's context actions are already displayed on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found