共用方式為


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 屬性集。 您必須使用此識別碼從 ContactStore 重新擷取連絡人,才能存取連絡人的其餘屬性資料。

適用於