locked
Reducing the size of a fixed header while scrolling a TableView RRS feed

  • Question

  • User196244 posted

    Hi there,

    I've updated my app so that "profile pages" look more appealing. I inspired from a Xamarin University video https://www.youtube.com/watch?time_continue=2&v=4HlLjTZQzjM and implemented something like that (screenshot from the video and custom overlay):

    Now, my question is how could I possibly "detect" the scrolling of the TableView so that I could reduce the size of the fixed header? Goal is something similar to that: https://www.w3schools.com/howto/howtojsshrinkheaderscroll.asp

    The underlying layout is a grid with 3-4 rows, the last one being the container for the TableView.

    I'm targeting both iOS and Android.

    Thanks

    Thursday, December 13, 2018 3:37 PM

Answers

  • User196244 posted

    I ended up using a ScrollView and recreating the look and feel of a TableView using custom classes for TableSection, TextCell, ImageCell, ... based on Grid and StackLayout. With that I could handle the Scrolling event and do whatever I wanted.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, December 19, 2018 10:27 AM

All replies

  • User180523 posted

    @XavierPerseguers said: Now, my question is how could I possibly "detect" the scrolling of the TableView It raises an event.

    Thursday, December 13, 2018 3:53 PM
  • User180523 posted

    Wait... I'm making an assumption that the TableView does not scroll itself. That it is a fixed sized inside a ScrollView If I"m wrong about that let me know.

    Thursday, December 13, 2018 3:55 PM
  • User196244 posted

    From my experience you are not supposed to put a TableView within a ScrollView since the TableView already takes care of the scrolling and you would have a double scrolling effect...

    Thursday, December 13, 2018 3:57 PM
  • User196244 posted

    Possibly something to investigate, although only the iOS part is described: https://mikecodes.net/2016/02/01/stretchy-uitableview-headers-with-xamarin/

    Thursday, December 13, 2018 4:10 PM
  • User196244 posted

    @ClintStLaurent Tried your idea of using a scrollview, if I declare a custom renderer for both iOS and Android, I could prevent the TableView from scrolling on its own (https://forums.xamarin.com/discussion/129621/xamarin-forms-tableview-without-scrolling).

    However it looks like that after that, the height of the TableView is not computed correctly anymore. I first thought that my last item was slightly cut but in fact, I miss a whole block below.

    Thursday, December 13, 2018 4:51 PM
  • User196244 posted

    I ended up using a ScrollView and recreating the look and feel of a TableView using custom classes for TableSection, TextCell, ImageCell, ... based on Grid and StackLayout. With that I could handle the Scrolling event and do whatever I wanted.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, December 19, 2018 10:27 AM