Remove separator beneath ListView GroupHeaderTemplate?

jfritschjfritsch USUniversity ✭✭
edited November 2016 in Xamarin.Forms

Is there any way to remove the separator beneath the ListView group headers?

image

I'm not doing anything special in the DataTemplate.

  <ListView.GroupHeaderTemplate>
    <DataTemplate>
      <ViewCell 
        Height="45">
        <StackLayout
          BackgroundColor="White"
          VerticalOptions="FillAndExpand"
          HorizontalOptions="FillAndExpand">
          <StackLayout
            VerticalOptions="CenterAndExpand"
            Margin="15, 0, 5, 0">
            <Label
              Text="{Binding LongName}" />
          </StackLayout>
        </StackLayout>
      </ViewCell>
    </DataTemplate>
  </ListView.GroupHeaderTemplate>

Best Answer

Answers

  • LuisRodriguez92LuisRodriguez92 USMember ✭✭✭

    How did you make that? Could you provide me the example or where you have guided, please...

    For you question: check this...

    I hope that this help you.

  • jfritschjfritsch USUniversity ✭✭

    @LuisRodriguez92, thank you though I'm not sure that link helps. That doesn't seem to be related to Xamarin specifically.

  • EllenKEllenK USMember ✭✭

    @jbf I set the SeparatorColor of the ListView. On android, this also colors the group separator. Maybe you can color it white, so you don't see it anymore?

    This solution does not work on ios. I hope someone else has a solution for that?

  • jfritschjfritsch USUniversity ✭✭

    @EllenK, thanks, you're right, it looks like the SeparatorColor does change the color of the separator under the group header in Android. So yes, setting that color to the same as the background would appear to do the trick.

    However, I'm seeing what you're seeing, the separator under the group header in iOS seems to always be a light gray color and is unaffected by the SeparatorColor.

    Also, setting SeparatorVisibility="None" only affects the separators of the rows of the ListView on both Android and iOS. You can set SeparatorVisibility="None" and SeparatorColor="Red" on Android and still get a red separator to show under the group headers. Those same settings would hide the separators of the rows on iOS, but not change the separator under the group header to red as it would just stay light gray.

  • EllenKEllenK USMember ✭✭

    @jbf Yes I noticed the same behavior. We have a xamarin subscription, so I'm currently emailing with @JimmyGarrido about this problem. I'll let you know when I have a solution

  • jfritschjfritsch USUniversity ✭✭

    Thank you for the follow up, @EllenK. I will keep an eye on that bug. The fact that it hasn't been touched since May 2016 isn't very reassuring though, unfortunately.

  • DomHaasDomHaas CHMember

    That did the trick for me:
    <br /> SeparatorVisibility="None"<br /> SeparatorColor="Transparent"<br />

    Using only the Color White didn't work, it was still visible, but with Transparent it wasn't anymore.
    Not sure if it matters when your using another Color though...

  • DungLe.3727DungLe.3727 USMember

    @DomHaas said:
    That did the trick for me:
    <br /> SeparatorVisibility="None"<br /> SeparatorColor="Transparent"<br />

    Using only the Color White didn't work, it was still visible, but with Transparent it wasn't anymore.
    Not sure if it matters when your using another Color though...

    This works. Thank you.

  • HenricBerglfHenricBerglf SEMember ✭✭

    Can it be true that this bug still not have been corrected on Forms-iOS?
    I have a custom listview renderer, if I change separator line or remove it the line below group header is still present and it's pure white and that is not very nice compared to my color palette on pages... Please answer Xamarin crew.

  • veryhumbleveryhumble USMember ✭✭

    I have the same Issue. Does not work on iOS 11.1 with the latest Stable Xamarin.Forms

Sign In or Register to comment.