Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string Image = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn2/187738_100000230436565_1427264428_q.jpg";
- <Image Name="img" HorizontalAlignment="Left" VerticalAlignment="Top" Width="66" Height="66" Source="{Binding Image} " />
- var bitmapImage = new BitmapImage();
- bitmapImage.BeginInit();
- bitmapImage.UriSource = new Uri("https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn2/187738_100000230436565_1427264428_q.jpg");;
- bitmapImage.EndInit();
- img.Source = bitmapImage;
- var imgUrl = new Uri("https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn2/187738_100000230436565_1427264428_q.jpg");
- var imageData = new WebClient().DownloadData(imgUrl);
- // or you can download it Async won't block your UI
- // var imageData = await new WebClient().DownloadDataTaskAsync(imgUrl);
- var bitmapImage = new BitmapImage {CacheOption = BitmapCacheOption.OnLoad};
- bitmapImage.BeginInit();
- bitmapImage.StreamSource = new MemoryStream(imageData);
- bitmapImage.EndInit();
- return bitmapImage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement