0

I am new to xaml and wpf in general. I am trying to make an image appear in a user control this is the code I use:

   BitmapImage captchaSource = new BitmapImage();
                        captchaSource.BeginInit();
                        captchaSource.UriSource = new Uri(_captchaData.ImgUrl);
                        captchaSource.EndInit();
                        captchaImg.Source = captchaSource;

this is the ui code:

<Image Height="105" HorizontalAlignment="Left" Margin="12,38,0,0" Name="captchaImg" Stretch="Fill" VerticalAlignment="Top" Width="276" Grid.ColumnSpan="2" />

But nothing happens. No image appears. This is the url in _captchaData.ImgUrl http://www.google.ro/images/srpr/logo3w.png

Does anyone have any idea why this is?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Para
  • 2,022
  • 5
  • 34
  • 73
  • possible duplicate of [WPF Image UriSource and Data Binding using http:\\ URL](http://stackoverflow.com/questions/3148163/wpf-image-urisource-and-data-binding-using-http-url) – cimmanon Sep 01 '15 at 20:26

1 Answers1

2

from previous question:

"WebURL can't be provided as a source to UriSource property of BitmapImage. If it is weburl you need to download that image locally and bind that path to UriSource."

Community
  • 1
  • 1