Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 在绑定之前,如何在WP7中获取图像_Image_Windows Phone 7_Silverlight 4.0 - Fatal编程技术网

Image 在绑定之前,如何在WP7中获取图像

Image 在绑定之前,如何在WP7中获取图像,image,windows-phone-7,silverlight-4.0,Image,Windows Phone 7,Silverlight 4.0,我为listbox的图像绑定工作过。为此,我已将图像Url绑定到图像源。我的问题是某个URL无效,不包含图像。通常我加载了defalut图像,因为没有url包含项目 该url无效,将图像绑定为空像素。在这里,我想显示默认图像。如果图像中没有像素意味着不需要绑定 string Url=“Some Url.jpg” 将此“URL”绑定到图像 请帮助我为此,请尝试在您的图像内容中提供与您的图像内容尺寸相等的背景图像。默认情况下,当URL中没有图像时,它会显示背景图像。在背景中使用Stackpanel,

我为listbox的图像绑定工作过。为此,我已将图像Url绑定到图像源。我的问题是某个URL无效,不包含图像。通常我加载了defalut图像,因为没有url包含项目

该url无效,将图像绑定为空像素。在这里,我想显示默认图像。如果图像中没有像素意味着不需要绑定

string Url=“Some Url.jpg”

将此“URL”绑定到图像


请帮助我

为此,请尝试在您的图像内容中提供与您的图像内容尺寸相等的背景图像。默认情况下,当URL中没有图像时,它会显示背景图像。

在背景中使用Stackpanel,因此当加载图像时,它将默认显示Stackpanel的颜色,当加载图像时,它将显示图像,从而隐藏了背景色

StackPanel background = new StackPanel();
background.Background = new SolidColorBrush(Colors.LightGray);

Image img1 = new Image();
img1.Height = 250;
img1.Stretch = Stretch.UniformToFill;

LowProfileImageLoader.SetUriSource(img1, new Uri(n.Image, UriKind.RelativeOrAbsolute));
background.Children.Add(img1);