I am trying to implement the following layout structure using Xamarin Forms components:
- ScrollView (which displays a sticky header when scrolling)
- Title & body text
- Tab Switching Component
- Tab 1: CollectionView of items (load new items on ItemThresholdReached)
- Tab 2: CollectionView of items (")
The desired behaviour is that when scrolling down either of the CollectionViews, the content above this (the text and tab switcher) should scroll out of view and be hidden by the sticky header. Upon scrolling back to the top of the collection view, it would scroll to the top of the page, revealing the content at the top and the sticky header would hide. Essentially, the Collection View and header content should scroll together as one scrolling view. With the above structure, the scroll isn't working because these CollectionViews are inside of an outer ScrollView.
I am using Collection View elements here because I am utilising the ItemThresholdReachedCommand to efficiently load more elements to the collection. The length of the collections will potentially be in the hundreds so performance is also important.
So far I have tried the following:
I set the header content as the header element of the Collection Views so that they would scroll as one. However this doesn't work because the header content is shared by both collection views, including the tab switcher component which wraps both Collection Views. Therefore this content cannot be placed into Collection View header elements.
I have also tried using a BindableLayout instead of CollectionView but this has none of the built-in events that Collection View has and I have read that Bindable Layout shouldn't be used for larger lists of items.
If anyone has any advice on the best way of trying to achieve this, it would be much much appreciated. At this point it feels impossible in Xamarin Forms!
Related
There are many outline items (menus) and many views and forms in the current running system.
The view is actually the same content, but the conditions are different.
Is there a way to have only one view and set conditions in the outer frame to display the content of the view?
for example:
There are 3 outer frame items (menu), click any outer frame item, a view will be displayed.
Menu 1 will open the view sorted by name
Menu 2 will open the view sorted by serial number
Menu 3 will open the view sorted by date
The views are all the same content, but different sorting methods are set to display.
As in the example, because there are 3 sorting methods, there are 3 views.
Is there a way to become only one view?
You can't control sorting. If you look at the NotesUIView class, you'll see there are no methods available for that. There's not much available there at all.
The only way you can control a view from code outside the view is by embedding it in a form, subform, or page, and using the Show Single Category feature.
I'm displaying a GroupedList view, and have both enabled the group header and jumplist. I've tried to hide the Group header, but so far with no luck. This property I want to hide is GroupDisplayBinding. If I don't set it, a default of ToString for my Item is displayed. I just want it gone, as a regular list only with the jump option enabled.
A little update: I searched some samples and what I want is a TableView with and indexed list as displayed here: https://developer.xamarin.com/guides/ios/user_interface/tables/part_2_-_populating_a_table_with_data/#Adding_an_Index
Best regards
Xamarin.Forms listview allows you to specify your own layout for the listview group via GroupHeaderTemplate property. You can use this layout to keep the header content empty.
Have a look at Customizing Listview Grouping
If you want to define the group header layout in code you will have to create a new subclass of ViewCell and build the layout. See an example at Enhancing Xamarin.Forms ListView with Grouping Headers
I am using Xamarin forms and my app has a list of items as a list view and each list item need to have a Picker. How do I bind data to the Picker controllers? Is there a way to access the child items inside a list view?
Just define your data template for the list view as normal (there are a lot of examples for this on the web), then inside the item template bind the desired item to a picker control (also a lot of examples out there).
There shouldn't be anything special about it.
I have a region in which I need to have a tabbed view (simple) however if I want the tab content to be differently layout - not sure how to achieve it. I can create different layout with multiple region and corresponding view, but how do I attach this to tab content, given that applyout can only be attached to region? Or can this be attached to one of the div of tab-content using $el?? Need some pointers.
Not sure I entirely understand your question.. But here goes.
I have implemented a navigation component where I can pass a tabsCollection and region. It will set up a region for the content and a list of tabs above it. When a tab is clicked it will fire the callback on the model in the tabsCollection which can be used to display what ever content you want.
There are more complex ways to handle this to allow for caching of a tabs content. But basically using a Backbone collection for the tabs with their own function for displaying content will do the trick.
In may Marionette app I do have set a layout with 3 regions
headerRegion
mainRegion
footerRegion
I am using the footer region to display detail views of my models (itemViews).
Now I do have the situation, that I want to use this region with collectionView in combination with a button-group: Add-Button (adds a model/itemView) and a OK-Button (closes/hides the collectionView and the button-group. I would like to handle these 2 itemViews as a component, showing and hiding them in 1 step.
I am not sure what the right way to do this is.
Option1:
show collection view in subregion1 of footerRegion and the button-group in subregion2 of footerRegion
Option2:
create a new Layout and nest it
Option3:
do it somehow with a compositeView?
Option4:
some combination with jquery hide/show the button-group?
My vote is for Option #2: nested layout. I do this a lot and it works very well. It's easy to manage and easy to work with, IMO.