Homepage image
Sample of the Day RSS Feed

Sample Downloads
C# version:
http://code.msdn.microsoft.com/CSTFSWorkitemDataGridView-2c27f82b
VB version: http://code.msdn.microsoft.com/VBTFSWorkitemDataGridView-cf1ac9b0

Today’s code sample demonstrates how to create a Custom Data Grid work item control of Visual Studio.  It’s created by our star sample writer: Ruiz Yi.

imageYou can find more code samples that demonstrate the most typical programming scenarios by using Microsoft All-In-One Code Framework Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates. If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage http://1code.codeplex.com/.

 

Introduction

The CSTFSWorkItemDataGridControl sample demonstrates how to create a Custom Data Grid work item control of Visual Studio.

  • Display a Field value in DataGrid
  • Save the data in DataGrid to a WorkItem Field
  • Support customize the Columns' Name
  • Avoid  Illegal characters

 

Building the Sample

Team Explorer 2010 is required. And then update following assembly references:

  • Microsoft.TeamFoundation.Client
  • Microsoft.TeamFoundation.Common
  • Microsoft.TeamFoundation.WorkItemTracking.Client
  • Microsoft.TeamFoundation.WorkItemTracking.Controls

 

Running the Sample

1. Copy following items to %USERPROFILE% \AppData\Local\Microsoft\Team Foundation\Work Item Tracking\Custom Controls.

  • DataGridControl.wicc
  • CSTFSWorkItemDataGridControl.dll

If you want to deploy them to multiple clients, the Team Members component in TFS Power Tools is a great tool.

2. Use WitAdmin importwitd command line to import the WIT Controls (WIT Controls.xml) WorkItem Type.

See http://msdn.microsoft.com/en-us/library/dd312129.aspx. TFS Power Tools also supplies a more convenient approach

3.  Open Team Explorer in Visual Studio, connect to the Team Project to which you import the WIT Controls

4.  Create a new WIT Controls work item, and you will see


5.  Type the title and data in the DataGrid, then save the work item.

6. In the history tab, you can see the saved value of Demo. GridField

 

More Information

Work Item Tracking Custom Controls

IWorkItemControl Interface