How do I convert a WPF window to a bitmap?

I want to take screen shots of all the windows associated with an application and allow the user to edit them. I am not sure how to convert a window to a bitmap image though.

I want to do something like this...

WindowCollection handles = Application.Current.Windows;
List<Image> windowList = new List<Image>();
foreach (Window window in handles)
{
do something here to turn each window into a bitmap
windowList.Add(bitmapFromWindow)
}

I have found related questions, but nothing that answers my question. If you find any related resources please post.

Answers


You can use RenderTargetBitmap

or have a look at that one:

http://blogs.msdn.com/b/swick/archive/2007/12/02/rendering-ink-and-image-to-a-bitmap-using-wpf.aspx


Need Your Help

Result from a sub-property of wcf service is null

wcf properties subclass

Ok so I have two objects that look like this in my WCF service. When my MyProfile property in my User class comes back to the client all of its properties are null; however, nothing else is.

Weird UIView coordinate issue

iphone xcode uiview

I am writing a universal application. As a result I have set it up so that my XIB/NIBs are not created with the view controllers, but are created separately and then linked to the view controller by