Phone Book 1.0

Using Visual Studio and C# we will build a Universal Windows Platform phone book application that displays a list of contacts. The UI (XAML) and business logic (C#) code snippets are shown below.

Contact.cs

public class Contact
{
        public Uri picture { get; set; }
        public string name { get; set; }
        public string phone { get; set; }

        public Contact(Uri _picture, string _name, string _phone)
        {
            this.picture = _picture;
            this.name = _name;
            this.phone = _phone;
        }
}

App.xaml.cs

/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
    // Contacts
    public static ObservableCollection<Contact> contacts = new ObservableCollection<Contact>();
    ... 

AddPage.xaml

AddPage.xaml.cs

MainPage.xaml

MainPage.xaml.cs

Demo

Design view in Visual Studio while developing the application:

Fig. 1.32. Visual Studio view during app development

Start the app via Debug > Start Debugging or press F5.

Fig. 1.33. Universal phone book app showing a list of contacts

Profile images used

Last updated