public async void SubOnClicked(object Sender, EventArgs args) { //calls the Get Classrooms Function to get a list of all the classrooms dropDownList = await Connection.GetClassrooms(); //iterates through the list foreach (var o in dropDownList) { //creates a new button for each item in the list Button className = new Button { Text = o }; //adds the same function to each button className.Clicked += OnNameClicked; //adds the button to the global stack info.Children.Add(className); } }