Friday, 1 June 2018

Xamarin.Forms: How to hide extra separator lines in ListView

Introduction

In this article we will learn how to remove extra iOS ListView separator lines in Xamarin.Forms.

Description

For example, we have a ListView with limited items, in this case ListView in android will display the separator lines upto the items count but in iOS we can see the extra separator lines also.

How can we remove extra lines?

To hide these extra separator lines in iOS ListView, we have lot of options:

  • Putting  SeparatorVisibility="None" and using BoxView as line separator.
  • Fixed size to the ListView.
  • Adding a view to the ListView footer.
But simple solution is that just add  Footer="" to your ListView like below

  1. <ListView Footer="" ItemsSource="{Binding EmployeesName}">  
  2.    <ListView.ItemTemplate>  
  3.       <DataTemplate>  
  4.           <TextCell Text="{Binding EmployeeName}" />  
  5.       </DataTemplate>  
  6.    </ListView.ItemTemplate>  
  7. </ListView>

Output:

 

No comments:

Post a Comment