tags:

views:

40

answers:

1

Very simple question. I want to take a picture/image of a usercontrol very often and display that picture somewhere else in my application. I am not going to save the image to the disk.

The question is, how do I take a image of usercontrol?

+2  A: 

Easy, use a VisualBrush. Just point the VisualBrush's Visual property to the control that you want to paint somewhere else. It will update automatically.

Example http://msdn.microsoft.com/en-us/library/ms771563.aspx

Josh Einstein
Looks good! Just what I wanted :) However I am a little disappointed it doesnt support Image but only Rectangle and Border from what I understand.
bobjink
No, it should support anything that derives from Visual. Do you mean you want to use the visual as a BitmapSource for an Image control? Or do you want to capture an Image control?
Josh Einstein
I would like something like: myImage = visualBrush;Reason is that Image has a stretch property. I want to make sure that the image/visualbrush is uniform.
bobjink
Ignore my comment. You can set the streth property on the visualbrush. This works perfectly :) Thanks!
bobjink