Silverlight Datagrid - image in template cell shown only after scroll out/in view
I have a SL4 DataGrid开发者_JAVA百科 with one template column. The column template contains an image (source points to an resource inside the xap) and a textblock. The image source is set using a binding to the view-model + a value converter that converts to a valid path to the image.
For most rows it works, however for one row the image is not visible when the page is shown. BUT if I scroll that row out of view (even by a pixel out, but has to be out) then in view again, the image appears.
Any idea what kind of magic is going on? :)
Thanks!
I was having the same problem a few days ago and in my case the problem was on the property change notification.
Turns out it was only half a bug: the data template referenced the wrong image (one which didn't exist). This caused the grid to correctly display a blank space instead of the non-existant image.
However, what's strange is that after scrolling the row out/in-view the grid would display one of the images used in other rows, when it should have in fact stayed blank. I haven't found out why that is and in the meantime switched to a commercial grid product.
精彩评论