Forum Xamarin.Forms

Is there a way to disable the sticky headers of a grouped ListView? (iOS)

15mgm1515mgm15 USMember ✭✭✭✭

Hello!

I've been trying to do this with Custom renderers but it seems to me that this may not be possible. Does anyone know some information about this?

I have tried with different approaches like:

https://stackoverflow.com/questions/1074006/is-it-possible-to-disable-floating-headers-in-uitableview-with-uitableviewstylep
https://stackoverflow.com/questions/664781/change-default-scrolling-behavior-of-uitableview-section-header/3984585#3984585
https://stackoverflow.com/questions/19056428/how-to-hide-first-section-header-in-uitableview-grouped-style

But without ant luck, any comment on this would be appreciate it.

Best Answers

  • yawnoyawno USMember ✭✭
    Accepted Answer

Answers

  • 15mgm1515mgm15 USMember ✭✭✭✭

    Bump.

  • 15mgm1515mgm15 USMember ✭✭✭✭

    Any information about this would be much appreciate it.

  • 15mgm1515mgm15 USMember ✭✭✭✭

    @seanyda I haven't thought of that approach thanks for the idea! nevertheless this will imply some refactor of my code that will affect my sprint.

  • yawnoyawno USMember ✭✭
    Accepted Answer
  • 15mgm1515mgm15 USMember ✭✭✭✭

    @yawno Exactly! thanks for the answers the bad news is that I've lost the pull to refresh feature.

  • yawnoyawno USMember ✭✭
    edited February 2018

    @15mgm15 Unfortunately my project doesn't include pull to refresh so I am not 100% sure what your problem is. The issue is probably occurring because the new table being created is missing something that the old table had. My best bet is that its the RefreshControl. You could try to change the code to this.

                    var tbl = new UITableView(Bounds, UITableViewStyle.Grouped)
                    {
                        Source = Control.Source,
                        RefreshControl = Control.RefreshControl
                    };
    

    Let me know if that helps as I don't have a project where I can test it myself

    Also to anyone else reading this forum I had problems where there was weird spacing for my section headers, and there was a problem with extra spacing at the top of the listview. The following fixed this.

                    Control.SectionFooterHeight = 0;
                    Control.SectionHeaderHeight = 0;
                    Control.ContentInset = UIEdgeInsets.Zero;
    
  • 15mgm1515mgm15 USMember ✭✭✭✭

    @yawno too good to be true, I think I will grab the whole refresh control from the ListViewRenderer of the Xamarin.Forms GitHub and give it a try, Thanks for the ideas tho.

    I did also have the same spacing issues and solve it by using:

    tbl.SeparatorStyle = UITableViewCellSeparatorStyle.None;

  • MarkLMarkL GBMember ✭✭

    @15mgm15 Did you manage to get the refresh working on the custom renderer. If so how did you manage it?

  • 15mgm1515mgm15 USMember ✭✭✭✭

    @MarkL Yes, I had to set assign a native pull to refresh to my custom ListView. I am pretty sure you can get the previous object (properties and events) and assign them to the new list object.

  • MarkLMarkL GBMember ✭✭

    @15mgm15 That's what I did but I ended up getting 2 refresh spinners appearing in the list view, one correctly placed from the native refresh control and another one that appeared on the right hand side when the forms listview IsRefreshing property got set to true. I've managed to hack around that now by overriding the properties on an inherited listview and using reflection to fire off its Refreshing event. Thanks for your input though

  • 15mgm1515mgm15 USMember ✭✭✭✭

    @MarkL Yeah! exactly the same thing happened to me and I also resolved it using hacks

  • 15mgm1515mgm15 USMember ✭✭✭✭

    @SandipAhluwalia I didn't notice this was ever released, you rock! I will do a blog post about this.

Sign In or Register to comment.