tags:

views:

27

answers:

1

Hi,

I'm using a listbox with a template like the following.

<ListBox.ItemTemplate>
    <DataTemplate>
        <Image Source="{Binding}" Width="100" />
    </DataTemplate>
</ListBox.ItemTemplate>

I bind this to an observable collection conataining 130 paths to images (all do exist, read out using System.IO.Directory) but only a few get really displayed. No exceptions that come up. Only white places where the images should be. Has anybody seen something else.

Sascha

A: 

Never seen this before but Binding is suppressing errors by default. When there are errors you can see them when you run in debug en watch in the output window of visual studio and make sure the option of the combobox "Show output from:" is set to "Debug"

Hope that this will help you to the real problem.

EDITED:

If you don't see a problem may you can find it out by hooking into the Image.ImageFailed Event. More help can be found here :

http://msdn.microsoft.com/en-us/library/system.windows.controls.image.imagefailed%28v=VS.95%29.aspx

Wouter Janssens - Xelos bvba
Already looked at the debug output. No errors. Wouldn't explain why some images get shown and the most others not.
Sascha
I suppose all your images are of the format as specified: BMP, JPEG, PNG, TIFF, Windows Media Photo, GIF, and ICON? Because that are the supported formats for image in WPF
Wouter Janssens - Xelos bvba
Only jpegs are allowed (and filtered)
Sascha
did you try to hook into the ImageFailed Event?
Wouter Janssens - Xelos bvba
Yes with no additional help. Though I think it's OutOfMemory exceptionsnot beeing logged to Output: Debug. I solved through binding thumbnails instead of original images.
Sascha
As this answer should have lead to the solution I accept this one.
Sascha
@Sascha: thank you for accepting the answer that have lead to the solution
Wouter Janssens - Xelos bvba