Udostępnij za pośrednictwem


ContactPanelActivatedEventArgs.Contact Property

Definition

Gets the selected contact from the Contact Panel.

public:
 property Contact ^ Contact { Contact ^ get(); };
Contact Contact();
public Contact Contact { get; }
var contact = contactPanelActivatedEventArgs.contact;
Public ReadOnly Property Contact As Contact

Property Value

The selected contact.

Implements

Examples

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.
    }
}

Remarks

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.

Applies to