Reputation: 12073
I would like to save up my current form (actually its part, a specific kind of crop image) look and use it as image on another silverlight control/page (dynamiccally and programatically obviously)
I have found a question here about this which is 2 years old and its answered there is no way to do so in SL2.0
Silverlight: Create image from silverlight controls
I wasn't able to find answer in internet so I am asking whether it is possible now in SL4.0?
Upvotes: 0
Views: 1426
Reputation: 1405
In one of my WPF projects I use RenderTargetBitmap to render the contents of a control to a bitmap. I found that you can't use that in Silverlight, but I did a search and found a forum post mentioning that WriteableBitmap.Render might do a similar thing in Silverlight.
Upvotes: 0
Reputation: 10296
Use the WriteableBitmap class.
int PreviewWidth = 200;
int PreviewHeight = 200;
var writeableBitmap = new WriteableBitmap(PreviewWidth, PreviewHeight);
writeableBitmap.Render(<somecontrol>, null);
writeableBitmap.Invalidate();
Upvotes: 5