how to dynamically update listview based on values of class

I am developing a contact book application wherein I have a listview with a add button. On clicking the add button it redirects the user to a modal page asking for it's name, email id, institution. All of this details are saved in a ContactDetails class. On clicking done button on the modal page I want to display the contents in my listview.

Any suggestions on how to implement this successfully.

Code am currently working on are as follows:
ContactDetails.cs

public class ContactDetails
{
    public string Name { get; set; }
    public string Inst { get; set; }
    public string EmailId { get; set;}  
    public int Mob { get; set;}
}

ContactDetailsModalPage.xaml.cs

public partial class ContactDetailsModalPage: ContentPage
{
    CandidateDetails cd = new CandidateDetails();
    async void OnDoneClicked(object sender, System.EventArgs e)
    {
        cd.Name = (string)candNameEntry.Text; 
        cd.Inst = (string)candInst.Text;
        cd.EmailId = (string)candEmailId.Text;
        cd.Mob = Convert.ToInt32(candMobNumber.Text);

        List<ContactDetails> candList = new List<ContactDetails>();
        candList.Add(cd);

        await Navigation.PopModalAsync();

    }


    public CandidateDetailsModalPage()
    {
        InitializeComponent();

    }
}

I am not able to understand as to what should I provide as the itemsource for my listview so that it can dynamically display the value that are stored in the ContactDetails class by modal page.

Sign In or Register to comment.