2
I’m trying to access the Contact Contact List list in the Contacts List class to view. The problem is that although the list is filled in Contact, in Contacts Lists it appears empty.
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;
}