I have the following XAML in my document:
<Border HorizontalAlignment="Right" VerticalAlignment="Bottom"
Height="100" Width="100"
BorderBrush="Red" BorderThickness="2">
<Image x:Name="image"
Source="http://myinternalserver/mywebservice/getimage.aspx?id=1234&ContentType=Image" />
</Border>
The image shows up fine in Win10 and Win8, but in Win7 all I get is a red border with a transparent background and no image inside. When I use a static URL, like to the google logo, it renders in all versions.
Anyone have any idea how I can make the image render in Windows 7?
According to this post WebUrl can't be specified as the Source of a BitmapImage. I recommend to you to make a helper class instead of doing so in the code-behind of the view. Also I would freeze the created image for performance.
Try to check possible exception by subscribing on the Image.ImageFailed
event from the code-behind file:
public MainWindow()
{
InitializeComponent();
image.ImageFailed += ImageFailed;
}
private void ImageFailed(object sender, ExceptionRoutedEventArgs e)
{
Console.WriteLine(e.ErrorException);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With