user1120998
user1120998

Reputation: 229

Before Binding how to get the image in WP7

I have worked for Image binding for listbox. For that I have binded the Image Url to Image Source. My proplem is someURL not valid does not contain image. Normally I have loaded defalut image for no url contains items.

That not valid url, binded the image as empty pixel. In this i want to show default image. If no pixel in image means, binding not needed.

string Url="Some URl.jpg";

Binded this "URL" to the Image.

Pls Help me

Upvotes: 0

Views: 243

Answers (2)

Mohit Verma
Mohit Verma

Reputation: 1660

Use Stackpanel at background, so when image is loading , it will show by default color of stackpanel, and when image is loaded it will show Image, thereby hiding the background color

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);

Upvotes: 0

SENTHIL KUMAR
SENTHIL KUMAR

Reputation: 647

For this try to give a background image in your image content which is equal dimensions of ur image content..by default it shows the background image when no image in the URL.

Upvotes: 1

Related Questions