A ListView with an expanding footer

Hey guys,

I've been Googling around for a while and I'm unable to find something that will help me do what I need.

I want a ListView where the footer will expand to fill the screen if there are not enough items to fill the list (And stay in the scroll with a minimum height when its full.

What I'm trying to accomplish:
image
image

Once the minimum height is hit, it should scroll.

Any ideas?

Thanks in advance

Best Answer

Answers

  • Currently, I'm thinking a custom StackLayout that allows me to use datatemplate, adding an expand label to the end, and wrapping it all in a scrollview. Just want to know if anyone has a better idea.

  • stvansolanostvansolano UMInsider, University ✭✭✭

    hey @RossGrambo.4106 I have this accordion sample in case if might be helpful. Feel free to fork it and extend with the behavior you want :)

    Let me know

  • RossGrambo.4106RossGrambo.4106 USMember
    edited August 2015

    Thanks! I'll see what I can get going with it :smile:

    Can't get too much from it unfortunately. I'm looking for a footer to always stay at the bottom of a list, and have its height expand when there is a small number of items in the list. Your solution would work great if I had a set height on my footer. :(

    I actually had another list I wanted an accordion for, so this sample would be perfect for that! :wink:

  • Anyone else got any ideas?

  • rohitasthanarohitasthana USMember

    this is accordian control and one of guy made it in weather control in horizontal orientation check his post http://adventuresinxamarinforms.com/2015/04/29/creating-a-xamarin-forms-accordion-control-without-custom-renders/

  • Hmm.. I think I might have been unclear with my question. I'm not looking for an accordion effect.

    I want one extra item always at the end of a listview that will auto-expand when there is extra screen height. Meaning when there is 1 item in the listview, its height would be 500, when there are two, it would be 400, 3 -> 300, 4-> 200, 5 -> 100, 6 -> 100, 7 -> 100, 8 -> 100, etc.
    (Supposing the total height of the listview is 600, each entry is 100, and the minimum height is set to 100.)

  • Guess there's nothing like this out there already

  • stvansolanostvansolano UMInsider, University ✭✭✭

    I haven't see anything like that but it might be possible. Have you tried extending one of those examples and have it your own?

    Choose one, fork the code and let's prototype it out :)

  • ChaseFlorellChaseFlorell CAInsider, University mod

    Can you not use the footer in that instance? Simply don't expand the ListView, and put a StackLayout below it.

  • @ChaseFlorell
    This is a big part of the problem that I can't get around: http://forums.xamarin.com/discussion/19874/listview-inside-stacklayout-a-height-problem

    ListView always expands. Also, putting a listview inside of a scrollview causes it to expand even more into the additional space allowed from the scrollview.

    Meaning I can't scale the listview correctly, meaning the label/stacklayout under it cannot expand correctly.

  • Wow! Thank you! Thats exactly what I was looking for! :)

  • skadookkunnanskadookkunnan Member ✭✭
    edited March 15

    Hi @ChaseFlorell,

    I have a similar implementation to be done. However, my listview row height is dynamis (I use HasUnevenRows=True). How can I achieve the same with LayoutOptions?

    Just setting up the LayoutOptions of the StackLayout, Vertical=FillAndExpand, Horizontal=FillAndExpand does not help to get the right result.

    Could you please help?

    Anyone has come across similar issue. Kindly help.

    Thank you in advance!

    Sincerely,
    Sagar

Sign In or Register to comment.