Forum Xamarin.Forms

Advanced ListView

I am trying to create a List with items structured as in the picture. I cant figure out how I should combine that kind of ListItem that can be expanded (see arrow) plus having the text fields like shown in the picture. On top of it I am trying to include so that each section of the list should have an header. Could somebody give me a hint of how to achieve the ListView as below:

Best Answer

Answers

  • igorkr_10igorkr_10 Member ✭✭✭✭

    Your text is Label or Entry?

  • batmacibatmaci DEMember ✭✭✭✭✭

    Syncfusion Sflistview has this option. You can use it if you like.

  • JohnHardmanJohnHardman GBUniversity mod

    @igorkr_10 - What's the situation with expandable cells in ListView on iOS now? It used to be problematic, but I haven't tried it for quite a while so don't know if the problem was resolved.

  • igorkr_10igorkr_10 Member ✭✭✭✭

    @JohnHardman said:
    @igorkr_10 - What's the situation with expandable cells in ListView on iOS now? It used to be problematic, but I haven't tried it for quite a while so don't know if the problem was resolved.

    I don't know. I develop only for android at this time =)

  • arturmullerarturmuller Member ✭✭

    @igorkr_10
    When I used the view like this:

    <ListView ItemsSource="{Binding Items}"> <ListView.ItemTemplate> <DataTemplate> <local:AwesomeView /> </DataTemplate> </ListView.ItemTemplate> </ListView>

    I get this exception:

    What am I missing here?

  • igorkr_10igorkr_10 Member ✭✭✭✭
    Any stacktrace in output?
  • arturmullerarturmuller Member ✭✭
    edited February 1

    at (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr) at Xamarin.Forms.Internals.TemplatedItemsList2[TView,TItem].ActivateContent (System.Int32 index, System.Object item) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:534
    at Xamarin.Forms.Internals.TemplatedItemsList2[TView,TItem].CreateContent (System.Int32 index, System.Object item, System.Boolean insert) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:543 at Xamarin.Forms.Internals.TemplatedItemsList2[TView,TItem].GetOrCreateContent (System.Int32 index, System.Object item) [0x00023] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:602
    at Xamarin.Forms.Internals.TemplatedItemsList2[TView,TItem].get_Item (System.Int32 index) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:337 at Xamarin.Forms.Platform.Android.ListViewAdapter.GetCellsFromPosition (System.Int32 position, System.Int32 take) [0x0003b] in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:539 at Xamarin.Forms.Platform.Android.ListViewAdapter.GetCellForPosition (System.Int32 position) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:454 at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (System.Int32 position, Android.Views.View convertView, Android.Views.ViewGroup parent) [0x0006d] in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:225 at Android.Widget.BaseAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (System.IntPtr jnienv, System.IntPtr native__this, System.Int32 position, System.IntPtr native_convertView, System.IntPtr native_parent) [0x0001a] in <f136c45b4a184119b54f2647ad4225f6>:0 at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.98(intptr,intptr,int,intptr,intptr)

  • arturmullerarturmuller Member ✭✭

    Any idea on why this happens @igorkr_10 ?

  • igorkr_10igorkr_10 Member ✭✭✭✭
    You need to use ViewCell in DataTemplate for ListView.
    CollectionView does not need ViewCell
  • arturmullerarturmuller Member ✭✭

    Thanks for answering @igorkr_10

    If I put the AwesomeView inside of a ViewCell it shows me empty default ListItems.

    Cant understand what Im doing wrong. This is the code now:

    <ListView ItemsSource="{Binding Items}"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <local:AwesomeView /> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>

  • arturmullerarturmuller Member ✭✭

    Got it working. Thank you very much @igorkr_10

  • igorkr_10igorkr_10 Member ✭✭✭✭
    > @arturmuller said:
    > Got it working. Thank you very much @igorkr_10

    And what the problem was?
  • arturmullerarturmuller Member ✭✭

    @igorkr_10 Adding the ViewCell element and raising the requested height so it became visible

Sign In or Register to comment.