I currently have about 5-6 tabs these tabs all have the same content. I want when the next tab will load the new content I have to refer to this article
https://www.syncfusion.com/forums/147281/loading-content-in-sftabview and follow but it doesn't work, and i found the performance of sftbaview quite slow although the content null took about 3-4 seconds to load. I'm sorry that my English level is not good
I binding in viewmodel
string[] RssItems = {
"https://gamek.vn/trang-chu.rss",
"https://cafef.vn/trang-chu.rss",
"https://thanhnien.vn/rss/home.rss",
"https://tuoitre.vn/rss/tin-moi-nhat.rss",
"https://tinhte.vn/rss",
"https://cafebiz.vn/cong-nghe.rss"};
public void SetContent()
{
//Process Auto generate tabitem
if (RssItems.Length != 0)
{
int i = 0;
foreach (var itemRss in RssItems)
{
var NamePath = itemRss.Substring(8);
int index = NamePath.IndexOf('.');
if (index > 0)
{
var pieces = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(NamePath.Substring(0, index).ToLower());
//TabItemContents content = new TabItemContents(itemRss);
TabItemHeaders headers = new TabItemHeaders(pieces, ColorItems.GetValue(i).ToString());
tabItem = new SfTabItem
{
HeaderContent = headers.Content,
Content = null,
FontIconFontFamily = "Arial",
FontIconFontSize = 100
};
i += 1;
Tabitems.Add(tabItem);
}
}
}
private void HandleSelected(object obj)
{
//get property element in list header
TabItemCollection tabItems = (obj as SfTabView).Items;
foreach (var item in tabItems)
{
int selectedIndex = tabItems.IndexOf(item);
if (selectedIndex == index)
{
((item.HeaderContent as StackLayout).Children[0] as PancakeView).Margin = new Thickness(0, 5, 0, 0);
((item.HeaderContent as StackLayout).Children[0] as PancakeView).Padding = new Thickness(0, 0, 0, -1);
if (item.Content == null)
{
item.Content = GetItemContent(selectedIndex);
}
}
else
{
((item.HeaderContent as StackLayout).Children[0] as PancakeView).Margin = new Thickness(0, 10, 0, 0);
((item.HeaderContent as StackLayout).Children[0] as PancakeView).Padding = new Thickness(0, 0, 0, -6);
}
}
}
private Xamarin.Forms.View GetItemContent(int index)
{
return new TabItemContents(RssItems.GetValue(index).ToString()).Content;
}
*TabItemContents is content page