connersz connersz - 5 months ago 68
C# Question

Xamarin Stacklayout not being populated

I have a Stacklayout on screen and it's populated at different times with labels from the code-behind.

The problem is, I have this one method that doesn't populate the Stacklayout. It uses the same identical code as the other methods. It runs through the code successfully but it just does not show on screen.

'readout' is the Stacklayout.

public async void HandleNFC(string convertedtag)
PeopleLocationsForUserRoot peoplelocationforuser = await WebDataAccess.GetPeopleLocationForUser("ConroyJ", 1);

Label label1 = new Label { Text = "Successfully clocked out @ " + convertedtag, TextColor = Color.Black };

DisplayAlert("NFC", convertedtag, "cancel");



in a Forms app, you can get a reference to your MainPage like this


you will also need to cast it correctly in order to call a custom method

  var main = (MyMainPageType) App.Current.MainPage;