-api-id | -api-type |
---|---|
P:Windows.ApplicationModel.Activation.ContactPanelActivatedEventArgs.Contact |
winrt property |
Gets the selected contact from the Contact Panel.
The selected contact.
The selected contact will be an empty contact with only its Id property set. You must use this Id to re-retrieve the contact from the ContactStore in order to get access to the rest of the contact's property data.
protected async override void OnActivated(IActivatedEventArgs args)
{
if (args.Kind == ActivationKind.ContactPanel)
{
// At this point, ContactPanelActivatedEventArgs.Contact
// is an empty Contact. Only its Id property is set.
ContactPanelActivatedEventArgs panelArgs = (ContactPanelActivatedEventArgs)args;
// To get access to all of the Contact's property data, you must
// use the Id to re-retrieve the Contact from the ContactStore.
ContactStore store = await ContactManager.RequestStoreAsync(ContactStoreAccessType.AppContactsReadWrite);
Contact contact = await store.GetContactAsync(panelArgs.Contact.Id);
// Now you have a fully populated Contact to work with.
}
}