Take Screen Shot From Media Element in WPF

Introduction

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.

MediaElement1.gif

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.

MediaElement2.gif

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.

MediaElement3.gif

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

MediaElement4.gif

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

MediaElement5.gif

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

MediaElement6.gif

Hope this article helps.