I want to generate a tableview, where the sections and table would be generated from the values retrieved from the database.
I followed this link, and followed the approach which says how to create a custom table view, but I just keep getting blank page.
Following is my code:
public MainPage()
{
List titles = new List()
{
"First Section", "Second Section"
};
List models = new List()
{
new HomePageListViewModel
{
ID = 1, Lists = "Label1", title = "First Section"
},
new HomePageListViewModel
{
ID = 2, Lists = "Label2", title = "First Section"
},
new HomePageListViewModel
{
ID = 3, Lists = "Label3", title = "Second Section"
},
new HomePageListViewModel
{
ID = 4, Lists = "Label4", title = "Second Section"
}
};
Categories cat = new Categories();
foreach (var sections in titles)
{
var labels = from s in models
where s.title == sections
select s;
cat.Add(sections, labels.ToList());
}
//BindingContext = cat;
InitializeComponent();
}
The table view logic is provided in the above link.
Can anyone please guide me how to achieve the above through c#, or anything with my approach here?.
Thanks In Advance!!!..