ContactPanelActivatedEventArgs.Contact 属性

定义

从联系人面板中获取所选联系人。

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

属性值

所选联系人。

实现

示例

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

注解

所选联系人将是仅设置了其 Id 属性的空联系人。 必须使用此 ID 从 ContactStore 重新检索联系人,才能访问联系人的其余属性数据。

适用于