How to take screenshots of WPF applications in correct size and content

2

1

I usually take screenshots of single windows via the built-in key combination Alt+Print. Unfortunately this does not work well for more and more applications - all of them are WPF applications.

Usually the screen shots have at least one of the following properties:

  • the screenshot is larger than expected and contains parts of the screen around the actual window

  • the screenshot has the correct size but includes parts of other windows, e.g. the Windows task bar. Of course the task bar might be in front of the window, but taking screen shots of "normal" programs works fine.

How do I take screenshots of WPF application which are correct in size and content?

I'd like to avoid the extra effort of checking all the screenshots for correctness, reproducing the situation, taking them again in case of issues or repairing/faking them manually in any pixel manipulation program (e.g. Paint.NET).

I observe this on Windows 7 x64 SP 1, all official updates installed, but it might apply to other Windows versions as well (not tested yet). .NET 4.5 is installed. The application itself might only need the built-in .NET 3.5.1.

It's reproducible on a virtual machine with the same settings.

Examples:

Screenshot of an application running in maximized mode. The screen shot includes parts of the task bar.

Screenshot 1 - maximized application showing task bar

Screenshot of a progress dialog which is behind the task bar. The screenshot also includes the task bar, while it doesn't for non WPF applications.

Screenshot 2 - progress bar behind the task bar

Thomas Weller

Posted 2014-06-02T13:59:15.233

Reputation: 4 102

The key combination you are using should only capture the active window, even on a dual monitor setup, which works for all windows executables include wpf applications. – Ramhound – 2014-06-02T14:02:47.100

1Have you tried the Snipping Tool? – slybloty – 2014-06-02T14:07:54.830

Usually a Problem comes up when applications are using "Ribbon", especially custom Ribbon Implementations that are not MS Office. Usually, the application is larger than it appears, and some of the content is transparent. Maybe that is the problem for you.

Edit: Might be good to confirm if that is actually the case. – private_meta – 2014-06-02T14:08:38.943

@slybloty: Using the Snipping tool has the same problem. It shows the border of the window in red but also includes the taskbar when taking the screen shot. – Thomas Weller – 2014-06-02T14:11:25.670

You might have to use an image manipulation application to alter the screenshots to your needs. – slybloty – 2014-06-02T14:15:59.680

@slybloty: yes, that's what I have to do at the moment. It's time-consuming and I want to avoid the extra effort. Since it works for standard dialogs, I wonder whether something's wrong with my machine. – Thomas Weller – 2014-06-02T14:37:15.223

As I said before, have you checked if the problem only occurs when you use WPF applications with Ribbon bar Functionality? – private_meta – 2014-06-02T14:46:35.977

No answers