Reputation: 255
I have several buttons that all enter one page.
How do I tell that page which button called it?
And can a page be bind to multiple pages or multiple tables in a database?
I actually have several lists of API that I do not want to for each create a separate page for. I want to create a page and show all the lists in one page, but separately.
That is, if I have 10 lists of 20 items, each 20 items should be displayed separately, not 200 items together!
Can I do this?
Thanks to those who guide me!
Upvotes: 1
Views: 114
Reputation: 89082
for each button click, pass a parameter to the page
void ButtonClickX(object sender, EventArgs a)
{
Navigation.PushAsync(new ListPage("somevalue"));
}
then in your page constructor
string PageType;
void ListPage(string pageType)
{
PageType = pageType;
}
override void OnAppearing()
{
switch (PageType)
{
case "Value1":
MyListView.ItemsSource = await APICall1();
break;
case "Value2":
MyListView.ItemsSource = await APICall2();
break;
...
}
}
Upvotes: 3