/// <summary> /// Invoked when the selected collection of files changes. /// </summary> /// <param name="sender">The GridView instance used to display the available files.</param> /// <param name="e">Event data that describes how the selection changed.</param> private void HandleSelectedContactChanged(Object sender, SelectionChangedEventArgs e) { // Update the picker 'basket' to remove any newly removed items foreach (var removedItem in e.RemovedItems.Cast <Contact>()) { if (_contactPickerUI.ContainsContact(removedItem.Id)) { _contactPickerUI.RemoveContact(removedItem.Id); } } // Update the picker 'basket' with the newly selected items foreach (var addedItem in e.AddedItems.Cast <Contact>()) { if (!_contactPickerUI.ContainsContact(addedItem.Id)) { _contactPickerUI.AddContact(addedItem); } } }
void ContactList_SelectionChanged(object sender, SelectionChangedEventArgs e) { foreach (SampleContact added in e.AddedItems) { AddSampleContact(added); } foreach (SampleContact removed in e.RemovedItems) { if (contactPickerUI.ContainsContact(removed.Id)) { contactPickerUI.RemoveContact(removed.Id); OutputText.Text = removed.Name + " was removed from the basket"; } } }