Xamarin Forms - Layout Cycle detected. Layout could not complete - windows

I have a xamarin forms page with a listview and a picker. On the changed event of the picker, I populate the listview. On Windows phone, intermittently, I get this exception:
System.Windows.LayoutCycleException: Layout cycle detected. Layout could not complete

Sounds like a timeout issue due to the number of items set in the ItemSource.
I would explicitly set the height value of the ViewCell and the Children of that view cell so that Windows Phone doesn't try to calculate the height for every item
See this Xamarin Forum post for more info:
https://forums.xamarin.com/discussion/41813/layout-cycle-detected-layout-could-not-complete-after-resetting-listview-itemssource

Related

Xamarin Forms Collection View wrong updating cells on iOS + scroll to top when set new item source

I have Collection View for first time on Xamarin. It works good on List, that is only once, but when items are updating (Observable collection) collection view goes crazy.
Set new ItemsSource when user is scrolling list, makes scroll to top (on old listview it stays where it was scrolled). It is annoying on both platforms. I have fixed it on iOS by setting ItemsUpdatingScrollMode = ItemsUpdatingScrollMode.KeepLastItemInView, but items are still fading when reloading.
On iOS data that are displayed and then updated are updated wrong, even if I use observable collection and implement INotifyPropertyChanged. Looks like collection view is caching data and not refresh when it should.
I thought new Xamarin Forms (5.0.0.2083) brings more usefull things but for now it brongs bugs. I will back to classic ListView.

How to implement a selection control like Outlook with Xamarin

I am creating an event screen like Outlook's. The issue I am coming across is that the autocompletebox I am using from Syncfusion doesn't automatically grow in height as more tokens are added.
The current workflow is exactly like outlooks. When the control is clicked on, it brings you to another page where you can select tokens. On return, the selected items populate the autocomplete circled below.
The approach I currently took is to have a listview. Scrolling is disabled for the listview since the page resides in a scrollview and nested scrollviews aren't recommended for xamarin. The height of the listview is dependent on the number of selecteditems.
I am wondering if there's another approach or control that would be more suited for my situation? Or if someone has come across a autocomplete control where the height will grow.

Xamarin.Forms - ListView can not load whole ViewCell

I am having an issue with loading ViewCell in ListView in Xamarin.Forms application.
ViewCell is displayed correctly but only half of it. I tried to scroll down but I couldn't. The ListView ends loading but the ViewCell is designed to continue.
Thank you for your answers !
Take a look on ListView.HasUnevenRows Property:
To automatically size row height to fit content, the developer first
sets the HasUnevenRows property to true; and, second, either leaves
RowHeight at its default value of -1, or sets it to -1 if it has been
changed.
source
More details in official documentation.

Android Wear Horizontal ListView

I'm trying to realize this layout in android wear: Timer Custom App. I think this is like a listview with horizontal orientation, but WearableListView doesn't have this attribute.
Try using a GridViewPager and setting negative page margins :
pager = (GridViewPager) stub.findViewById(R.id.fragment_container);
pager.setPageMargins(0, -30);
You can then implement onClick listeners on the fragments to change the current page by just clicking at the right or left of the page like the native alarm app.

OnScroll Event in ListView using Xamarin Forms

I have a listView and when the receive a message, the listview should scroll to the end only, if it already in the end.
To make it clear, if the user is seeing old message, the listview shouldn't scroll to the end automatically, but if the is already on the on the listview when receiving a message the listview should automatically scroll to the end.
So I have to get the actual position of the ListView, I didn't see any property or method similar to get this position on the API.
So I was thinking if is possible to override an event like OnScroll, so I can save the current position of the ListView without using custom render.
This can be done using XamarinForms?
ListView doesn't fire Scrolled events like ScrollView does, but it does fire ItemAppearing and ItemDisappearingevents that you may be able to use to keep track of which items are currently visible.

Resources