I'm trying to access the ContactList of the Contact class in the ContactList class to view. The problem is that although the list is populated in Contact, it is empty in the Contact List.
public class Contato
{
string Nome { get; set; }
string Numero {get; set; }
public List<Contato> ListaDeContatos = new List<Contato>();
public async void Buscar()
{
ContactStore contactStore;
contactStore = await ContactManager.RequestStoreAsync();
var contatos = await contactStore.FindContactsAsync();
foreach (var item in contatos)
{
if (!string.IsNullOrEmpty(item.FirstName))
{
ListaDeContatos.Add(new Contato() { Nome = item.FirstName.ToString() + " " + item.LastName.ToString(), Numero = "12345678" });
}
}
}
public sealed partial class ListaContatos : Page
{
public ListaContatos()
{
...
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Contato contato = new Contato();
contato.Buscar();
listView.ItemsSource = contato.ListaDeContatos;
}