How i can display this pictures from contacts in xaml?
-
20-12-2019 - |
题
void _appContacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
{
foreach (var result in e.Results)
{
var stream = result.GetPicture();
if (stream != null)
{
BitmapImage bmp = new BitmapImage();
bmp.SetSource(stream);
Image img = new Image();
img.Source = bmp;
}
}
}
解决方案
I can able to get the picture of the contact using the following code, try this.
Contact con;
private void contactListBox_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
con = ((sender as ListBox).SelectedValue as Contact);
BitmapImage img = new BitmapImage();
img.SetSource(con.GetPicture());
ContactImage.Source = img;
}
Hope it helps you.
不隶属于 StackOverflow