Example #1
0
        private void contactsListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Contact selectedContact = (Contact)contactsListView.SelectedItem;

            if (selectedContact != null)
            {
                ContactDetailsWindow contactDetailsWindow = new ContactDetailsWindow(selectedContact);
                contactDetailsWindow.ShowDialog();
            }
        }
Example #2
0
        private void ContactListView_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (!(ContactListView.SelectedItem is Contact contact))
            {
                return;
            }
            var contactDetailsWindow = new ContactDetailsWindow(contact);

            contactDetailsWindow.ShowDialog();
            ReadContacts();
        }
Example #3
0
        private void ContactsListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // cast selected item to Contact because we know the object contained in the LV are Contacts
            Contact selectedContact = (Contact)contactsListView.SelectedItem;

            if (selectedContact != null)
            {
                ContactDetailsWindow contactDetailsWindow = new ContactDetailsWindow(selectedContact);
                contactDetailsWindow.ShowDialog();
            }
        }
Example #4
0
        private void contactListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var contact = contactListView.SelectedItem as Contact;

            /*We need to check null here as when we update any list member, then
             * SelectionChanged event occurs but SelectedItem is null in this case.
             */
            if (contact != null)
            {
                ContactDetailsWindow contactDetailsWindow = new ContactDetailsWindow(contact);
                contactDetailsWindow.ShowDialog();
                ReadDatabase();
            }
        }
Example #5
0
        private void contactsListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Whichever contact in the list view is clicked will be passed into the selecteditem
            ContactModel selectedContact = (ContactModel)contactsListView.SelectedItem;

            // To ensure a contact is chosen, we can use the following code
            if (selectedContact != null)
            {
                ContactDetailsWindow contactDetailsWindow = new ContactDetailsWindow(selectedContact);
                contactDetailsWindow.ShowDialog();

                ReadDatabase();
            }
        }