Tuesday, March 2, 2010

WPF Exception Message


Some errors help you, some don't. One of the most annoying ones in programming with WPF is: "No information was found about this pixel format"
This error by searching links on Google point that the problem can have two causes:
1) If you specify a URI to an image resource in your project somewhere but the URI is wrong (i.e. you moved the image but forgot to change the URI).
2) The pixel format you use for your image is incompatible with WPF.

As imagines are from resources and hardcoded, the first error seems to not happen. Also the error happens only for the second time the context toolbar is done. So I thought is a bug in image cache that we used also in TreeView to not duplicate your icons with your tree-view items.

I am not sure, as WPF is not open source, but it seems that when you destroy the icons in the contextual toolbar, WPF destroy images of the image cache. So I just disabled the image cache and everything seems going to normal.

Tomorrow I will fill the missing context information. Just if you will wanna try how it works, for Circle and Rectangle, you will have enabled in the nightly build.

No comments: