猿问

如何使用“Xamarin.Forms.Contacts 1.0.3”插件创建联系人列表视图?

我一直在研究一个插件,它允许我访问用户手机中的联系人以在列表视图中显示它们。我尝试使用 James Montemagno “ContactsPlugin”,但它不再受支持。所以,我找到了一个名为“Xamarin.Forms.Contacts 1.0.3”的插件,它声称能够访问联系人,但我不知道如何激活该插件以显示联系人。有谁知道如何使用这个插件或知道如何使用其他东西访问联系人?我目前使用的是最新版本的 Visual Studio 2017 for Mac。

插件链接:https : //www.nuget.org/packages/Xamarin.Forms.Contacts/


冉冉说
浏览 106回答 1
1回答

慕哥9229398

GitHub 存储库中有一个示例应用程序,可以准确地演示您想要的内容var contacts = await Plugin.ContactService.CrossContactService.Current.GetContactListAsync();lstContacts.ItemsSource = contacts;&nbsp; <ListView&nbsp;&nbsp; &nbsp; x:Name="lstContacts"&nbsp; &nbsp; &nbsp; &nbsp; <ListView.ItemTemplate>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <DataTemplate>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <ViewCell>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <StackLayout>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <Label Text="{Binding Name}"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <Label Text="{Binding Email}"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <Label Text="{Binding Number}"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </StackLayout>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </ViewCell>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </DataTemplate>&nbsp; &nbsp; &nbsp; &nbsp; </ListView.ItemTemplate>&nbsp; &nbsp; </ListView>
随时随地看视频慕课网APP
我要回答