Tab Items

21 Feb 2018 / 1 minute to read

Tab items can be configured in tab view through the Items property of SfTabView, where it holds collection of SfTabItem through TabItemsCollection

var allContactsGrid = new FrameLayout(ApplicationContext);
var favoritesGrid = new FrameLayout(ApplicationContext);
var contactsGrid = new FrameLayout(ApplicationContext);
allContactsGrid.SetBackgroundColor(Color.Red);
favoritesGrid.SetBackgroundColor(Color.Green);
contactsGrid.SetBackgroundColor(Color.Blue);
var tabItems = new TabItemCollection
{
new SfTabItem()
{
Title = "Calls",
Content = allContactsGrid
},
new SfTabItem()
{
Title = "Favorites",
Content = favoritesGrid
},
new SfTabItem()
{
Title = "Contacts",
Content = contactsGrid
}
};

tabView.Items = tabItems;
SetContentView(tabView);

Share the header space equally

In order to share the header space equally for the , we can set the number of tabs which can be distributed in the available space though VisibleHeaderCount of SfTabView.

tabView.VisibleHeaderCount = 3;