Take Screen Shot From Media Element In WPF


In the previous article about Media Element in WPF, we saw some of the basic functionalities. In this article we will see how can we take the screenshot of the Media (Video) we are playing.

Crating WPF Application Project

Fire up Visual Studio 2008 and Create a WPF Application and name the project as MediaSampleWPF.

I am just extending the feature that we experienced in our last application titled “Media Element In WPF”.

We will just add another Button to take ScreenShot. See following figure.

Now we will add an extension method that would help us capturing the Screen Shot.

Create a static class and add the following method to it.

Now in the Button click event handler add the following code to use the extension method and save the file.

Now that our application is ready to go. Run the application.

And when we capture it saves in the output directory (Bin folder of the project).

Hope this article helps.