Let say I have application menus in a database with their icon images (binary data). I extract those menus with the icons being byte[] type. However if there’s no icon set, then I would like to use default icon which comes not from database, but from xap (inside Resources folder). To display icons coming from database I use IConverter (byte[] to image), which is based on the code of the following question:
Silverlight 4.0: How to convert byte[] to image?
To be able to use my byte[]-to-image IConverter, I would also like to convert my default icon to byte[], which comes from xap. How I can do that? The following question suggested to use WriteableBitmap class, but I don’t know how to create WriteableBitMap from the xap source:
I may be miss understanding the question here (perhaps more details about your converter are required here), but if you converter class just returns an image based on its bytes, cant you just test for null bytes from the DB, then return your default image?
this way you simply return an image as the method declaration, and the implementation handles the null bytes case.
Is this on the right track?