I keep encountering this problem no matter what :
The List<Object> listArticles is simply keep adding data everytime the page appears ,it keep populating the data over and over again instead of simply display them once
I have tried to declare a tempList everytime the function is called , but no success
List<PlanDefinition> tempListArticles = new List<PlanDefinition>(listArticles)
How to encouter this problem?
async protected override void OnAppearing()
{
listArticles= articleView.getArticlesFromPlan();
PopulateOrderLists(listArticles);
base.OnAppearing();
}
protected override void OnDisappearing()
{
base.OnDisappearing();
}
private void PopulateOrderLists(List<PlanDefinition> listArticles)
{
List<PlanDefinition> tempListArticles = new List<PlanDefinition>(listArticles);
OrderTemplate prod = new OrderTemplate();
for (var i = 0; i < tempListArticles.Count; i++)
{
prod = new OrderTemplate();
prod.BindingContext = tempListArticles[i].Name;
OrderInformation.Children.Add(prod);
}
}