The Capture control can be added to any work item tracking type definition. Typically you would provide a label and then the Capture button, similar to the following image:

ScreenshotControl.jpg

And here’s a cool feature – if the clipboard doesn’t contain an image then the Capture button is disabled. It will become enable as soon as the user presses “print screen” or “alt-gr print-screen”.

DisabledScreenshotControl.jpg

When the button is pressed a “Save As Attachment” dialog is shown. The dialog lets the user enter the attachment name and comment as usual. Pressing OK will create a new attachment to the work item.

SaveAsDialog.jpg

It is also possible to click on the preview image to bring up a larger window with the screen shot:

EnlargeDialog.jpg

To make the capture control even more useful, I’ve also implemented an alternative “File Attachment” control. This control works just like the standard control but also provides the Capture feature.

AttachmentsControl.jpg

Schema
To use the control first create a work item type that contains the image. In essence the only thing that needs to be done is to include a new control in the <FORM> section in the work item XML. The following examples shows the syntax for the ScreenShot control and the FileAttachment control respectively:

<Control Type="ScreenshotControl" Label="Screenshot:" LabelPosition="Left" />

<Tab Label="File Attachments">
<Control Type="CaptureAttachmentsControl" LabelPosition="Top" />
</Tab>

After that the control and its associated .wicc files need to be deployed locally on each machine using the control (and no, the TFS web client will currently not handle custom controls). Team Explorer searches for custom controls in folder “Microsoft\Team Foundation\Work Item Tracking\Custom Controls” under Environment.SpecialFolder.CommonApplicationData folder first, then under Environment.SpecialFolder.LocalApplicationData.

So, that was it. Hopefully these little controls will fill part of the gap when it comes to handling screenshots in TFS work items.

Installation
In order to use this control, at two files must be present in the deployment folder:

AttachmentsControl.wicc
ScreenshotControl.wicc
CodePlex.WitCustomControls.dll

The deployment folder is located at the following location under a default client install: C:\ProgramData\Microsoft\Team Foundation\Work Item Tracking\Custom Controls.

Note in the 2010 release I renamed the control to CaptureAttachmentsControl. because if its has the same name it will override the builtin control. The main reason because the builtin control in 2010 has support for images and you may want to just use the builtin version as they provide similar funtionality. You can drag drop pretty much anything to the attachments control and it will create a file and attach it. You can also copy/paste images. To take a screenshot, hit the PrtScn key then Ctrl+V in the built-in attachments control.

Last edited Mar 27, 2010 at 12:54 AM by hayderc, version 8

Comments

rainschuetz Oct 9, 2012 at 11:55 AM 
Is it possible to implement the drag and drop features "Copied Files" and "Copied Text" in the CaptureAttachmentsControl?

vletroye Jul 31, 2008 at 11:17 AM 
There is a typo in your "Schema" paragraph... We have to use an upper case "S" in the control type : AttachmentSControl
Right ???

<Tab Label="File Attachments">
<Control Type="AttachmentSControl" LabelPosition="Top" />
</Tab>

MOlausson Nov 20, 2007 at 7:39 PM 
Please the the answer in the discussions forum.

zemag Nov 9, 2007 at 5:20 PM 
Can you please be more specific of what exactly we nee to have installed on the client machine and what installed on the TFS server machine? I seem to have TFS Sp1 installed on the server, but I can't seem to find the exact path you mention above (or the one mentioned in Naren's blog by that matter). Thank you so much for all your help...