Hi,
Here is the sample project upfront as you would prefer. It uses an Infragistics NetAdvantage for WPF 2012 volume 2 control, however the approach should work for all controls.
This is a follow-up on a blog that I had done a while back for creating images from controls: http://www.infragistics.com/community/blogs/petar_monov/archive/2012/03/14/controls-to-images.aspx . The last one used the rendered controls in the visual tree in order to render an image using the RenderTargetBitmap class, of course a few twists.
This was all cool, however there was always the question of how this can be done without adding the control to the visual tree to be visualized prior to rendering an image. The answer is actually quite simple, you can simulate the control’s lifecycle within the visual tree and get the same result, without actually adding the control anywhere.
This is why I decided to write this up in a blog and decided, on what better control to use than the XamBarcode, which many have requested to printed out behind the scene as a result to some data manipulation. All that is needed is an XamBarcode instance (in my case XamQRCodeBarcode) calling its Measure and Arrange measures with some sort of predefined boundaries in which the methods can work (in my case I am setting only the Width, so the XamBarCode can set the height accordingly/proportionally to the data and provide more accurate sizing of the desired image) and as in the above mentioned blog post:
RenderTargetBitmap.Render(xamBarCode);
and recieve this *.png file as result:
Hope you like this.