Search code examples
c#windows-phonewindows-phone-8.1

How to save a bitmapimge from url to an object of bitmap in wp8.1?


I want to save am image from [URL : https://www.example.com/folders/file.jpg][1] in an object of BitmapImage

I tried the following :

BitmapImage b = new BitmapImage();
b.SetSource(new Uri("https:www.example.com/folders/file.jpg", UriKind.RelativeOrAbsolute));

But its not working. Why?


Solution

  • This code test and work for me: Image MyImage = new Image();

            // Create source.
            BitmapImage bImage = new BitmapImage();
            bImage.UriSource = new Uri(@"https:www.example.com/folders/file.jpg", UriKind.RelativeOrAbsolute);
    
            // Set the image source.
            MyImage.Source = bImage;
    

    Tell me if work for you or need more info. Good luck man!